def set_parent(self, node):
self._parent = node<EOL>if node is None:<EOL><INDENT>self._depth = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>self._depth = node.get_depth() + <NUM_LIT:1><EOL><DEDENT>
Attach node to its parent.

Args:
    node: Parent node.

Note:
    ``node`` can be ``None``. In that case, the node is detached from its previous parent.