#NEWLINE# def desired_matches( desired , header ) : #NEWLINE# #INDENT# "Takes a list of desired mime-types in the order the server prefers to\n    send them regardless of the browsers preference.\n\n    Browsers (such as Firefox) technically want XML over HTML depending on how\n    one reads the specification. This function is provided for a server to\n    declare a set of desired mime-types it supports, and returns a subset of\n    the desired list in the same order should each one be Accepted by the\n    browser.\n\n    >>> desired_matches(['text/html', 'application/xml'],     ...     'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png')\n    ['text/html', 'application/xml']\n    >>> desired_matches(['text/html', 'application/xml'], 'application/xml,application/json')\n    ['application/xml']\n    " #NEWLINE# parsed_ranges = list ( map ( parse_media_range , header . split ( ',' ) ) ) #NEWLINE# return [ mimetype for mimetype in parsed_ranges if quality_parsed ( mimetype , parsed_ranges ) ]