code: def parse_accept_header(value, cls=None):
      
      if cls is None:
          cls = Accept
  
      if not value:
          return cls(None)
  
      result = []
      for match in _accept_re.finditer(value):
          quality = match.group(2)
          if not quality:
              quality = 1
          else:
              quality = max(min(float(quality), 1), 0)
          result.append((match.group(1), quality))
      return cls(result)
docs: Parses an HTTP Accept-* header.  This does not implement a complete
      valid algorithm but one that supports at least value and quality
      extraction.
  
      Returns a new :class:`Accept` object (basically a list of ``(value, quality)``
      tuples sorted by the quality with some additional accessor methods).
  
      The second parameter can be a subclass of :class:`Accept` that is created
      with the parsed values and returned.
  
      :param value: the accept header string to be parsed.
      :param cls: the wrapper class for the return value (can be
                           :class:`Accept` or a subclass thereof)
      :return: an instance of `cls`.