def parse_accept_header(accept_header):
 accept_items = []
 for (index, header) in enumerate(accept_header.split(',')):
  accept_items.append(AcceptItem(header, index))
 return sorted(accept_items)

def parse_accept_header ( accept_header ) : accept_items = [ ] for ( index , header ) in enumerate ( accept_header . split ( ',' ) ) : accept_items . append ( AcceptItem ( header , index ) ) return sorted ( accept_items )
parses an http accept-* header .