code: def numBlast_sort(blast, numHits, evalueT, bitT):
      header = ['
                'qstart', 'qend', 'tstart', 'tend', 'evalue', 'bitscore']
      yield header
      hmm = {h:[] for h in header}
      for line in blast:
          if line.startswith('
              continue
          line = line.strip().split('\t')
          line[10], line[11] = float(line[10]), float(line[11])
          evalue, bit = line[10], line[11]
          if evalueT is not False and evalue > evalueT:
              continue
          if bitT is not False and bit < bitT:
              continue
          for i, h in zip(line, header):
              hmm[h].append(i)
      hmm = pd.DataFrame(hmm)
      for query, df in hmm.groupby(by = ['
          df = df.sort_values(by = ['bitscore'], ascending = False)
          for hit in df[header].values[0:numHits]:
              yield hit