(fieldname, fieldvalue)
return list(reversed(sorted(result)))
Return a sorted HeaderElement list.

    Returns a sorted HeaderElement list
    from a comma-separated header string.
Return a sorted HeaderElement list.
Return a sorted HeaderElement list .
def header_elements(fieldname, fieldvalue):
    """Return a sorted HeaderElement list.

    Returns a sorted HeaderElement list
    from a comma-separated header string.
    """

    if not fieldvalue:
        return []

    result = []
    for element in fieldvalue.split(","):
        if fieldname.startswith("Accept") or fieldname == 'TE':
            hv = AcceptElement.from_str(element)
        else:
            hv = HeaderElement.from_str(element)
        result.append(hv)

    return list(reversed(sorted(result)))
def header_elements ( fieldname , fieldvalue ) : if not fieldvalue : return [ ] result = [ ] for element in fieldvalue . split ( "," ) : if fieldname . startswith ( "Accept" ) or fieldname == 'TE' : hv = AcceptElement . from_str ( element ) else : hv = HeaderElement . from_str ( element ) result . append ( hv ) return list ( reversed ( sorted ( result ) ) )