def total_number_of_clusters(tree) -> int:
    """Get the number of leaves in the tree."""
    if tree is None:
        return 1
    return sum(total_number_of_clusters(subtree)
               for subtree in tree.subregions)