def parse_mime_type(mime_type):
parts = mime_type.split("<STR_LIT:;>")<EOL>params = dict([tuple([s.strip() for s in param.split("<STR_LIT:=>")])for param in parts[<NUM_LIT:1>:] ])<EOL>full_type = parts[<NUM_LIT:0>].strip()<EOL>if full_type == '<STR_LIT:*>': full_type = '<STR_LIT>'<EOL>(type, subtype) = full_type.split("<STR_LIT:/>")<EOL>return (type.strip(), subtype.strip(), params)<EOL>
Carves up a mime-type and returns a tuple of the
       (type, subtype, params) where 'params' is a dictionary
       of all the parameters for the media range.
       For example, the media range 'application/xhtml;q=0.5' would
       get parsed into:

       ('application', 'xhtml', {'q', '0.5'})