docs: def filter_taxa(records, taxids, unclassified=False, discard=False):
      '''
      Selectively include or discard specified taxon IDs from tictax annotated FASTA/Qs
      Filters all children of specified taxon IDs
      Returns subset of input SeqRecords
      Taxon IDs of 1 and 2 are considered unclassified 
      '''
      taxids = set(taxids)
      kept_records = []
      ncbi = ete3.NCBITaxa()
      unclassified_taxids = {0,1}
      for r in records:
          taxid, rank, sciname, lineage = r.description.strip().partition(' ')[2].split('|')
          taxid = int(taxid)
          lineage = set(ncbi.get_lineage(taxid) or [0])  # lineage defined twice?
          intersection = lineage & taxids
          if taxid in unclassified_taxids and unclassified:
              kept_records.append(r)
          elif intersection and not discard:
              kept_records.append(r)
          elif not intersection and discard and taxid not in unclassified_taxids:
              kept_records.append(r)
  
      return kept_records