code: def do_gather(flist):
      
      hlist = []
      nskip = 3
      for fname in flist:
          fin = fits.open(fname)
          if len(hlist) == 0:
              if fin[1].name == 'SKYMAP':
                  nskip = 4
              start = 0
          else:
              start = nskip
          for h in fin[start:]:
              hlist.append(h)
      hdulistout = fits.HDUList(hlist)
      return hdulistout
docs: Gather all the HDUs from a list of files