def parse_obitools_fasta_entry(text, known_species=None):
    """Parse species from the OBITools extended FASTA header.

    See https://pythonhosted.org/OBITools/attributes.html which explains that
    OBITools splits the FASTA line into identifier, zero or more key=value;
    entries, and a free text description.

    We are specifically interested in the species_name, genus_name (used if
    species_name is missing), and taxid.

    >>> entry = "AP009202 species_name=Abalistes stellaris; taxid=392897; ..."
    >>> parse_obitools_fasta_entry(entry)
    (392897, 'Abalistes stellaris')

    Note this will *not* try to parse any key=value entries embedded in the
    first word (which taken as the identifier).
    """
    taxid = 0
    sp = ""
    identifier, description = text.split(None, 1)
    for part in description.split(";"):
        part = part.strip()  # We may be more lienent that OBITools here
        if part.startswith("taxid="):
            taxid = int(part[6:].strip())
        elif part.startswith("species_name="):
            sp = part[13:].strip()
        elif not sp and part.startswith("genus_name="):
            sp = part[11:].strip()
    return taxid, sp