def add(self, node):
if not isinstance(node, Node):<EOL><INDENT>raise TypeError()<EOL><DEDENT>for i, j in enumerate(self.__nodes):<EOL><INDENT>if j.node_id == node.node_id:<EOL><INDENT>self.__nodes[i] = node<EOL>return<EOL><DEDENT><DEDENT>self.__nodes.append(node)<EOL>
Add Node, replace existing node if node with node_id is present.