docs: def primary_mrna(entrystream, parenttype='gene'):
      """
      Select a single mRNA as a representative for each protein-coding gene.
  
      The primary mRNA is the one with the longest translation product. In cases
      where multiple isoforms have the same translated length, the feature ID is
      used for sorting.
  
      This function **does not** return only mRNA features, it returns all GFF3
      entry types (pragmas, features, sequences, etc). The function **does**
      modify the gene features that pass through to ensure that they have at most
      a single mRNA feature.
  
      >>> reader = tag.GFF3Reader(tag.pkgdata('pdom-withseq.gff3'))
      >>> filter = tag.transcript.primary_mrna(reader)
      >>> for gene in tag.select.features(filter, type='gene'):
      ...    assert gene.num_children == 1
      """
      for entry in entrystream:
          if not isinstance(entry, tag.Feature):
              yield entry
              continue
  
          for parent in tag.select.features(entry, parenttype, traverse=True):
              mrnas = [f for f in parent.children if f.type == 'mRNA']
              if len(mrnas) == 0:
                  continue
              _emplace_pmrna(mrnas, parent)
          yield entry