def remove_node_and_descendants(tree, node):
    """
    Removes a node and all its descendants from the tree
    """

    # not just tree.successors(node) because that changes as
    # nodes are removed
    children = [child for child in tree.successors(node)]
    for child in children:
        remove_node_and_descendants(tree, child)

    parent = next(tree.predecessors(node))

    tree.remove_edge(parent, node)
    tree.remove_node(node)

    return tree