def _intersect(d1, d2):
 res = {}
 for (key, val) in d1.iteritems():
  if ((key in d2) and (d2[key] == val)):
   res[key] = val
 return res

def _intersect ( d1 , d2 ) : res = { } for ( key , val ) in d1 . iteritems ( ) : if ( ( key in d2 ) and ( d2 [ key ] == val ) ) : res [ key ] = val return res
create intersection of two dictionaries .