(header)
return content_type, params_dict
Returns content type and parameters from given header

    :param header: string
    :return: tuple containing content type and dictionary of
         parameters
Returns content type and parameters from given header
Returns content type and parameters from given header
def _parse_content_type_header(header):
    """Returns content type and parameters from given header

    :param header: string
    :return: tuple containing content type and dictionary of
         parameters
    """

    tokens = header.split(';')
    content_type, params = tokens[0].strip(), tokens[1:]
    params_dict = {}
    items_to_strip = "\"' "

    for param in params:
        param = param.strip()
        if param:
            key, value = param, True
            index_of_equals = param.find("=")
            if index_of_equals != -1:
                key = param[:index_of_equals].strip(items_to_strip)
                value = param[index_of_equals + 1:].strip(items_to_strip)
            params_dict[key.lower()] = value
    return content_type, params_dict
def _parse_content_type_header ( header ) : tokens = header . split ( ';' ) content_type , params = tokens [ 0 ] . strip ( ) , tokens [ 1 : ] params_dict = { } items_to_strip = "\"' " for param in params : param = param . strip ( ) if param : key , value = param , True index_of_equals = param . find ( "=" ) if index_of_equals != - 1 : key = param [ : index_of_equals ] . strip ( items_to_strip ) value = param [ index_of_equals + 1 : ] . strip ( items_to_strip ) params_dict [ key . lower ( ) ] = value return content_type , params_dict