

def parse_dict_header(value, cls=dict):
    'Parse lists of key, value pairs as described by RFC 2068 Section 2 and\n    convert them into a python dict (or any other mapping object created from\n    the type with a dict like interface provided by the `cls` arugment):\n\n    >>> d = parse_dict_header(\'foo="is a fish", bar="as well"\')\n    >>> type(d) is dict\n    True\n    >>> sorted(d.items())\n    [(\'bar\', \'as well\'), (\'foo\', \'is a fish\')]\n\n    If there is no value for a key it will be `None`:\n\n    >>> parse_dict_header(\'key_without_value\')\n    {\'key_without_value\': None}\n\n    To create a header from the :class:`dict` again, use the\n    :func:`dump_header` function.\n\n    .. versionchanged:: 0.9\n       Added support for `cls` argument.\n\n    :param value: a string with a dict header.\n    :param cls: callable to use for storage of parsed results.\n    :return: an instance of `cls`\n    '
    result = cls()
    if (not isinstance(value, text_type)):
        value = bytes_to_wsgi(value)
    for item in _parse_list_header(value):
        if ('=' not in item):
            result[item] = None
            continue
        (name, value) = item.split('=', 1)
        if (value[:1] == value[(- 1):] == '"'):
            value = unquote_header_value(value[1:(- 1)])
        result[name] = value
    return result

dataset/ETHPy150Open Eforcers/gae-flask-todo/lib/werkzeug/http.py parse_dict_header/original