def tree_has_enough_background_and_foreground(
    tree, foreground_list, min_foreground=2, min_background=2
):
    """Return if the alignment has enoung background and foreground leafs"""
    leafs = set(leaf.name for leaf in tree.get_terminals())
    foreground = set(foreground_list)
    n_foreground = len(foreground & leafs)
    n_background = len(leafs - foreground)
    if n_background >= min_background and n_foreground >= min_foreground:
        return True
    return False