def relationship_diff(current_items, new_items):
 return {'add': {k: new_items[k] for k in (set(new_items.keys()) - set(current_items.keys()))}, 'remove': {k: current_items[k] for k in (set(current_items.keys()) - set(new_items.keys()))}}

def relationship_diff ( current_items , new_items ) : return { 'add' : { k : new_items [ k ] for k in ( set ( new_items . keys ( ) ) - set ( current_items . keys ( ) ) ) } , 'remove' : { k : current_items [ k ] for k in ( set ( current_items . keys ( ) ) - set ( new_items . keys ( ) ) ) } }
to be used in post and put/patch relationship requests .