code: def flatten_multidict(multidict):
      
      return dict([(key, value if len(value) > 1 else value[0])
                   for (key, value) in multidict.iterlists()])
docs: Return flattened dictionary from ``MultiDict``.