def remove_all(self, elements):
     new_elements = []
     pynode_core.enable_events(False)
     for x in elements:
         if isinstance(x, Node): new_elements.append((0, self.remove_node(x)._data()))
         elif isinstance(x, Edge): new_elements.append((1, self.remove_edge(x)._data()))
         else: new_elements.append((0, self.remove_node(self.node(x))._data()))
     pynode_core.enable_events(True)
     pynode_core.add_event(pynode_core.Event(pynode_core.js_remove_all, [new_elements]))
     pause(55)
 def remove_node(self, node):
     n = self.node(node)
     pynode_core.enable_events(False)
     for e in n.incident_edges():
         self.remove_edge(e)
     pynode_core.enable_events(True)
     del self._nodes[n._id]
     pynode_core.add_event(pynode_core.Event(pynode_core.js_remove_node, [n._internal_id]))
     pause(25)
     return n