def find_map_gen(main_list,pattern):
   """each call of next() method of this generator
   yields next index of main_list where pattern matches main_list[index]
   or raise StopIteration if there isn't next match
   
   main_list elements and pattern are maps with identical structure,
   pattern can have less keys
   
   meaning of 'match' need to be defined on your match function
   which have to compare value of pattern[key] with each element[key]
   and return list of True|False values for each element of main_list.
   It's up to you if match function does exact matching or for ex.
   for strings values pattern matching. All match fnc have to do is
   return for given key the list [first_elem_matches, second_elem_don't, ...]
   in True|False form, of course.

   """
   def varzip(a):
     return zip(*a)
 
   match_key_list = []
   true_tuple = tuple([True]*len(pattern))
   for key in pattern.keys():
      match_key_list.append(match(key,pattern,main_list))
   match_index_list = varzip(match_key_list)
   find_list = [true_tuple==x for x in match_index_list]
   for i,x in enumerate(find_list):
      if x: yield i
each call of next() method of this generator
   yields next index of main_list where pattern matches main_list[index]
   or raise StopIteration if there isn't next match
   
   main_list elements and pattern are maps with identical structure,
   pattern can have less keys
   
   meaning of 'match' need to be defined on your match function
   which have to compare value of pattern[key] with each element[key]
   and return list of True|False values for each element of main_list.
   It's up to you if match function does exact matching or for ex.
   for strings values pattern matching. All match fnc have to do is
   return for given key the list [first_elem_matches, second_elem_don't, ...]
   in True|False form, of course.

   
recipes/Python/528889_searching_in_list_of_maps/recipe-528889.py