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)))

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 ) ) )
return a sorted headerelement list from a comma-separated header string .