docs: def annotate_diamond(records, diamond_path):
      '''
      Retrieve scientific names and lineages for taxon IDs in Diamond output
      Returns taxonomically annotated SeqRecords with modified description attributes
      '''
      contigs_metadata = {}
      with open(diamond_path) as diamond_tax_fh:
          for line in diamond_tax_fh:
              contig, taxid, evalue = line.strip().split('\t')
              contigs_metadata[contig] = dict(taxid=int(taxid), evalue=float(evalue))
  
      ncbi = ete3.NCBITaxa()
      taxids = {m['taxid'] for m in contigs_metadata.values()} # set of taxids
      taxids_lineages = ncbi.get_lineage_translator(taxids)  # dict of taxid lists
      taxids_with_children = {x for v in taxids_lineages.values() for x in v}  # flatten to set
      taxids_names = ncbi.get_taxid_translator(taxids_with_children)
      taxids_ranks = ncbi.get_rank(taxids_with_children)
  
      for contig, md in contigs_metadata.items():
          md['sciname'] = taxids_names.get(md['taxid'])
          md['rank'] = taxids_ranks.get(md['taxid'], '')
          md['lineage_fmt'] = (':'.join([taxids_names.get(t, '')
                                         for t in taxids_lineages.get(md['taxid'], [])])
                                         if md['taxid'] else None)
  
      for r in records:
          md = contigs_metadata[r.id]
          r.description = f"{md['taxid']}|{md['rank']}|{md['sciname']}|{md['lineage_fmt']}"
      return records