def METHOD_NAME(self, old_node, operator):
    if old_node.bl_idname != 'SvPathLengthNode':
        return
    tree = self.id_data
    old_in_links = [link for link in tree.links if link.to_node == old_node]
    old_out_links = [link for link in tree.links if link.from_node == old_node]
    for old_link in old_in_links:
        new_target_socket_name = operator.get_new_input_name(old_link.to_socket.name)
        if new_target_socket_name in self.inputs:
            new_target_socket = self.inputs[new_target_socket_name]
            new_link = tree.links.new(old_link.from_socket, new_target_socket)
        else:
            self.debug("New node %s has no input named %s, skipping", self.name, new_target_socket_name)
        tree.links.remove(old_link)
    for old_link in old_out_links:
        if old_node.segment:
            new_source_socket_name = 'SegmentLength'
        else:
            new_source_socket_name = 'TotalLength'
        # We have to remove old link before creating new one
        # Blender would not allow two links pointing to the same target socket
        old_target_socket = old_link.to_socket
        tree.links.remove(old_link)
        if new_source_socket_name in self.outputs:
            new_source_socket = self.outputs[new_source_socket_name]
            new_link = tree.links.new(new_source_socket, old_target_socket)
        else:
            self.debug("New node %s has no output named %s, skipping", self.name, new_source_socket_name)