'Return a list of language tags sorted by their "q" values.  For example,
"en-us,en;q=0.5" should return ``["en-us", "en"]``.  If there is no
``Accept-Language`` header present, default to ``[]``.'

def parse(self, *args, **kwargs):

    header = self.__call__(*args, **kwargs)
    if (header is None):
        return []
    langs = [v for v in header.split(',') if v]
    qs = []
    for lang in langs:
        pieces = lang.split(';')
        (lang, params) = (pieces[0].strip().lower(), pieces[1:])
        q = 1
        for param in params:
            if ('=' not in param):
                continue
            (lvalue, rvalue) = param.split('=')
            lvalue = lvalue.strip().lower()
            rvalue = rvalue.strip()
            if (lvalue == 'q'):
                q = float(rvalue)
        qs.append((lang, q))
    qs.sort(key=(lambda query: query[1]), reverse=True)
    return [lang for (lang, q) in qs]
