def generic_multiedge_match(attr, default, op):
 if nx.utils.is_string_like(attr):
  attr = [attr]
  default = [default]
  op = [op]
 attrs = list(zip(attr, default))
 def match(datasets1, datasets2):
  values1 = []
  for data1 in datasets1.values():
   x = tuple((data1.get(attr, d) for (attr, d) in attrs))
   values1.append(x)
  values2 = []
  for data2 in datasets2.values():
   x = tuple((data2.get(attr, d) for (attr, d) in attrs))
   values2.append(x)
  for vals2 in permutations(values2):
   for (xi, yi) in zip(values1, vals2):
    if (not all(map((lambda x, y, z: z(x, y)), xi, yi, op))):
     break
   else:
    return True
  else:
   return False
 return match

def generic_multiedge_match ( attr , default , op ) : if nx . utils . is_string_like ( attr ) : attr = [ attr ] default = [ default ] op = [ op ] attrs = list ( zip ( attr , default ) ) def match ( datasets1 , datasets2 ) : values1 = [ ] for data1 in datasets1 . values ( ) : x = tuple ( ( data1 . get ( attr , d ) for ( attr , d ) in attrs ) ) values1 . append ( x ) values2 = [ ] for data2 in datasets2 . values ( ) : x = tuple ( ( data2 . get ( attr , d ) for ( attr , d ) in attrs ) ) values2 . append ( x ) for vals2 in permutations ( values2 ) : for ( xi , yi ) in zip ( values1 , vals2 ) : if ( not all ( map ( ( lambda x , y , z : z ( x , y ) ) , xi , yi , op ) ) ) : break else : return True else : return False return match
returns a comparison function for a generic attribute .