code: def parse_accept_lang_header(lang_string):
      
      result = []
      pieces = accept_language_re.split(lang_string)
      if pieces[-1]:
          return []
      for i in range(0, len(pieces) - 1, 3):
          first, lang, priority = pieces[i : i + 3]
          if first:
              return []
          priority = priority and float(priority) or 1.0
          result.append((lang, priority))
      result.sort(lambda x, y: -cmp(x[1], y[1]))
      return result
docs: Parses the lang_string, which is the body of an HTTP Accept-Language
      header, and returns a list of (lang, q-value), ordered by 'q' values.
  
      Any format errors in lang_string results in an empty list being returned.