def iter_multi_items(mapping):
 if isinstance(mapping, MultiDict):
  for item in mapping.iteritems(multi=True):
   (yield item)
 elif isinstance(mapping, dict):
  for (key, value) in mapping.iteritems():
   if isinstance(value, (tuple, list)):
    for value in value:
     (yield (key, value))
   else:
    (yield (key, value))
 else:
  for item in mapping:
   (yield item)

def iter_multi_items ( mapping ) : if isinstance ( mapping , MultiDict ) : for item in mapping . iteritems ( multi = True ) : ( yield item ) elif isinstance ( mapping , dict ) : for ( key , value ) in mapping . iteritems ( ) : if isinstance ( value , ( tuple , list ) ) : for value in value : ( yield ( key , value ) ) else : ( yield ( key , value ) ) else : for item in mapping : ( yield item )
iterates over the items of a mapping yielding keys and values without dropping any from more complex structures .