def add_node(self, node):
    assert isinstance(node, Node), 'Only node objects can be added through add_node'
    key = node.get_id()
    assert (key not in self.all_nodes), ('key %d for node already present' % key)
    self.all_nodes[key] = node
    if isinstance(node, DataNode):
        self.data_nodes[key] = node
    elif isinstance(node, MethodNode):
        self.method_nodes[key] = node
    else:
        self.regular_nodes[key] = node
def add_node(self, node):
    assert isinstance(node, Node), 'Only node objects can be added through add_node'
    key = node.get_id()
    assert (key not in self.all_nodes), ('key %d for node already present' % key)
    self.all_nodes[key] = node
    if isinstance(node, DataNode):
        self.data_nodes[key] = node
    elif isinstance(node, MethodNode):
        self.method_nodes[key] = node
    else:
        self.regular_nodes[key] = node