def canonical_genus_name(genus_name):
    """Get canonical genus name from GTDB or NCBI genus name."""
    if genus_name == 'g__':
        return genus_name
    prefix = genus_name[0:3]
    genus = genus_name[3:]
    underscore_pos = genus.rfind('_')
    if underscore_pos != -1:
        genus = genus[0:underscore_pos]
    return prefix + genus
