import copy


def prune_clade_from_tree(tree, clade_name):
    """
    Given a treefile, will prune out the specified clade.
    :param tree: Treefile read in with Bio.Phylo
    :param clade_name: Name of clade you want removed from the tree.
    :return: New Biopython tree object.
    """
    new_tree = copy.deepcopy(tree)
    if new_tree.find_any(clade_name) is not None:
        new_tree.prune(clade_name)
    else:
        raise AttributeError('Clade {} not found in tree. Cannot be pruned.'.format(clade_name))
    return new_tree