def partition_dict(dict_, keys):
 intersection = {}
 difference = {}
 for (key, value) in dict_.iteritems():
  if (key in keys):
   intersection[key] = value
  else:
   difference[key] = value
 return (intersection, difference)

def partition_dict ( dict_ , keys ) : intersection = { } difference = { } for ( key , value ) in dict_ . iteritems ( ) : if ( key in keys ) : intersection [ key ] = value else : difference [ key ] = value return ( intersection , difference )
return two dicts .