def set_ranks(taxonomy):
    """Set ranks for species/subspecies creation."""
    default_ranks = [
        "genus",
        "family",
        "order",
        "class",
        "subphylum",
        "phylum",
    ]
    taxon_rank = None
    if "subspecies" in taxonomy:
        ranks = ["species"] + default_ranks
        taxon_rank = "subspecies"
    else:
        ranks = default_ranks
        for rank in ["species"] + default_ranks:
            if rank in taxonomy:
                taxon_rank = rank
                break
    return ranks, taxon_rank