parameters: (fieldname, fieldvalue)
return_statement: return list(reversed(sorted(result)))
docstring: Return a sorted HeaderElement list from a comma-separated header string.
docstring_summary: Return a sorted HeaderElement list from a comma-separated header string.
docstring_tokens: Return a sorted HeaderElement list from a comma - separated header string .
function: def header_elements(fieldname, fieldvalue):
      """Return a sorted HeaderElement list from a comma-separated header string.
      """
      if not fieldvalue:
          return []
  
      result = []
      for element in RE_HEADER_SPLIT.split(fieldvalue):
          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)))
function_tokens: def header_elements ( fieldname , fieldvalue ) : if not fieldvalue : return [ ] result = [ ] for element in RE_HEADER_SPLIT . split ( fieldvalue ) : 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 ) ) )