def canonical_taxon(taxon):
    """Get taxon name without suffix."""
    if taxon.startswith('s__'):
        generic, specific = taxon.split()
        if '_' in specific:
            canonical_specific = specific.rsplit('_', 1)[0]
            return '{} {}'.format(generic, canonical_specific)
        else:
            return taxon
    rank_prefix = ''
    if taxon[1:3] == '__':
        rank_prefix = taxon[0:3]
        taxon = taxon[3:]
    if '_' in taxon:
        taxon = taxon.rsplit('_', 1)[0]
    return rank_prefix + taxon
