def inverse_dicts(*dicts):
 inverse = {}
 for dictionary in dicts:
  for (key, value) in dictionary.items():
   if isinstance(value, Iterable):
    for item in value:
     add_pair_to_dict(item, key, inverse)
   else:
    add_pair_to_dict(value, key, inverse)
 return inverse

def inverse_dicts ( * dicts ) : inverse = { } for dictionary in dicts : for ( key , value ) in dictionary . items ( ) : if isinstance ( value , Iterable ) : for item in value : add_pair_to_dict ( item , key , inverse ) else : add_pair_to_dict ( value , key , inverse ) return inverse
inverts the dicts .