def all_pairs_matching_predicate(values, pred):
 return filter((lambda pair: pred(*pair)), product(values, repeat=2))

def all_pairs_matching_predicate ( values , pred ) : return filter ( ( lambda pair : pred ( * pair ) ) , product ( values , repeat = 2 ) )
return an iterator of all pairs .