def parse_mime_type(mime_type):
 parts = mime_type.split(';')
 params = dict([tuple([s.strip() for s in param.split('=')]) for param in parts[1:]])
 full_type = parts[0].strip()
 if (full_type == '*'):
  full_type = '*/*'
 (type, subtype) = full_type.split('/')
 return (type.strip(), subtype.strip(), params)

def parse_mime_type ( mime_type ) : parts = mime_type . split ( ';' ) params = dict ( [ tuple ( [ s . strip ( ) for s in param . split ( '=' ) ] ) for param in parts [ 1 : ] ] ) full_type = parts [ 0 ] . strip ( ) if ( full_type == '*' ) : full_type = '*/*' ( type , subtype ) = full_type . split ( '/' ) return ( type . strip ( ) , subtype . strip ( ) , params )
parses a mime-type into its component parts .