function hkg_module, hkgmod, hseq, sequence_number, hkgmtb=hkgmtb  


if not keyword_set(hkgmtb) then begin
    w = where(hseq eq sequence_number, nw)
    if nw ge 1 then begin
        tspec = total(hkgmod(*,w),1)
        wv    = where( tspec ne 0, nwv)
        if nwv ge 1 then return, hkgmod(*,w(wv(0)))
    endif


    return, 0
endif else begin

;Get the SPEC LLD setting
    tbl = bytarr(8,8)
    offset1= 2*(32-hseq(0))
    tblend = offset1 + 63
    while n_elements(hkgmtb) gt tblend do begin
        tbl(*) = hkgmtb(offset1:tblend)
        slld = (tbl(6,*))(*)
        offset1 = offset1+64
        tblend  = tblend+64
        if total(slld) ne 0 then tblend = n_elements(hkgmtb) ;done here
    endwhile         
return, slld
endelse
return, 0
end