code: def metafetcher(bamfile, metacontig2contig, metatag):
      ''' return reads in order of metacontigs'''
      for metacontig in metacontig2contig:
          for contig in metacontig2contig[metacontig]:
              for read in bamfile.fetch(contig):
                  read.set_tag(metatag, metacontig)
                  yield reaf metafetcher(bamfile, metacontig2contig, metatag):
      ''' return reads in order of metacontigs'''
      for metacontig in metacontig2contig:
          for contig in metacontig2contig[metacontig]:
              for read in bamfile.fetch(contig):
                  read.set_tag(metatag, metacontig)
                  yield read
docs: return reads in order of metacontigs