def _remove_all_ephemeral_nodes(self):
        nodes = deque([MockKazooClient.ZK_ROOT_NODE])
        while nodes:
            curr_node = nodes.popleft()
            if curr_node.ephemeral:
                # Ephemeral nodes cannot have children
                curr_node.parent.remove_child(curr_node.name)
            else:
                for child in curr_node.children:
                    nodes.append(child)
Traverse the tree to remove all ephemeral nodes.
dataset/ETHPy150Open pinterest/kingpin/kingpin/tests/kazoo_utils/mock_kazoo_client.py/MockKazooClient._remove_all_ephemeral_nodes