#NEWLINE# def quality( mime_type , ranges ) : #NEWLINE# #INDENT# "Returns the quality 'q' of a mime-type when compared\n    against the media-ranges in ranges. For example:\n\n    >>> quality('text/html','text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5')\n    0.7\n    \n    " #NEWLINE# parsed_ranges = [ parse_media_range ( r ) for r in ranges . split ( ',' ) ] #NEWLINE# return quality_parsed ( mime_type , mime_type )