def all_queries(fn, obj, *param_lists):
 results = []
 params = [[obj]]
 for pl in param_lists:
  new_params = []
  for p in pl:
   for c in params:
    new_param = list(c)
    new_param.append(p)
    new_params.append(new_param)
  params = new_params
 results = [fn(*p) for p in params]
 return results

def all_queries ( fn , obj , * param_lists ) : results = [ ] params = [ [ obj ] ] for pl in param_lists : new_params = [ ] for p in pl : for c in params : new_param = list ( c ) new_param . append ( p ) new_params . append ( new_param ) params = new_params results = [ fn ( * p ) for p in params ] return results
given a fn and a first argument obj .