def METHOD_NAME(mime_type, ranges):
    """Return the quality ('q') of a mime-type against a list of media-ranges.
    Returns the quality 'q' of a mime-type when compared against the
    media-ranges in ranges. For example:
    >>> 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')
    0.7
    """
    parsed_ranges = [parse_media_range(r) for r in ranges.split(",")]
    return quality_parsed(mime_type, parsed_ranges)