<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def prune_clade(self, node_id):
 """Prune `node_id` and the edges and nodes that are tipward of it. Caller must delete the edge to node_id."""

        to_del_nodes = [node_id]
        while bool(to_del_nodes):
            node_id = to_del_nodes.pop(0)
            self._flag_node_as_del_and_del_in_by_target(node_id)
            ebsd = self._edge_by_source.get(node_id)
            if ebsd is not None:
                child_edges = list(ebsd.values())
                to_del_nodes.extend([i['@target'] for i in child_edges])
                del self._edge_by_source[
                    node_id]