def add_parent(self, parent):
        """

        :param parent:
        :return:
        """
        assert isinstance(parent, Node)
        self.parent_nodes.add(parent)
        if self not in parent.child_nodes:
            parent.add_child(self)
def add_parent ( self , parent ) : assert isinstance ( parent , Node ) self . parent_nodes . add ( parent ) if self not in parent . child_nodes : parent . add_child ( self )
:param parent:
        :return: