Accept language parsing

Write codeMedium20 minStripe style

Your task

Parse an HTTP Accept-Language header and return the language tags in server preference order. The header is a comma-separated list of tags, each optionally carrying a quality weight ';q=VALUE' (a float in [0,1]); a tag with no q defaults to q=1.0. Sort by q descending; tags with equal q must retain their original left-to-right order (stable). Trim whitespace. An empty header returns an empty list.

Examples

parse_accept_language(header: str) -> list[str]
Example 1
Inputparse_accept_language("en-US,en;q=0.9,fr;q=0.8")
Output["en-US", "en", "fr"]