human
I wrote the below code

    if (not header_val):
        return []
    def item(x):
        (e, r) = x.partition(u';')[::2]
        (p, v) = r.partition(u'=')[::2]
        q = 1.0
        if ((p == u'q') and v):
            try:
                q = max(0.0, min(1.0, float(v.strip())))
            except Exception:
                pass
        return (e.strip(), q)
    return tuple(map(itemgetter(0), sorted(map(item, parse_http_list(header_val)), key=itemgetter(1), reverse=True)))

What's a good function header?

Here's a good function header?
assistant
#Here's a good function header.

def sort_q_values(header_val):