def parse_media_range(range):
 (type, subtype, params) = parse_mime_type(range)
 if ((not params.has_key('q')) or (not params['q']) or (not float(params['q'])) or (float(params['q']) > 1) or (float(params['q']) < 0)):
  params['q'] = '1'
 return (type, subtype, params)

def parse_media_range ( range ) : ( type , subtype , params ) = parse_mime_type ( range ) if ( ( not params . has_key ( 'q' ) ) or ( not params [ 'q' ] ) or ( not float ( params [ 'q' ] ) ) or ( float ( params [ 'q' ] ) > 1 ) or ( float ( params [ 'q' ] ) < 0 ) ) : params [ 'q' ] = '1' return ( type , subtype , params )
parse a media-range into its component parts .