def parse_accept(headers):
#-------------------------
  """
  Parse an Accept header and return a dictionary with
  mime-type as an item key and 'q' parameter as the value.
  """
  return { k[0].strip(): float(k[1].strip()[2:])
                           if (len(k) > 1 and k[1].strip().startswith('q=')) else 1
             for k in [ a.split(';', 1)
              for a in headers.get('Accept', '*/*').split(',') ] }