#NEWLINE# def get_pointers_to_add_remove( self , pointers , new_pointers ) : #NEWLINE# #INDENT# diff = relationship_diff ( current_items = { pointer . node . _id : pointer for pointer in pointers } , new_items = { val [ 'node' ] [ '_id' ] : val for val in new_pointers } ) #NEWLINE# nodes_to_add = [ ] #NEWLINE# for node_id in diff [ 'add' ] : #NEWLINE# #INDENT# node = Node . load ( node_id ) #NEWLINE# if ( not node_id ) : #NEWLINE# #INDENT# raise exceptions . NotFound ( detail = 'Node with id "{}" was not found' . format ( node_id ) ) #NEWLINE# #UNINDENT# nodes_to_add . append ( node ) #NEWLINE# #UNINDENT# return ( nodes_to_add , diff [ 'remove' ] . values ( ) )