def languages(self):
        """
        Retrieve languages, sorted by most common to least common. The
        Accept-Languages header sometimes looks weird, i.e.
        "en-US,en;q=0.8,is;q=0.6,da;q=0.4" We will split on the first semi-
        colon.
        """
        language = PageView.headers['Accept-Language']
        first_language = fn.SubStr(
            language,  # String to slice.
            1,  # Left index.
            fn.StrPos(language, ';'))
        return (self.get_query()
                .select(first_language, fn.Count(PageView.id))
                .group_by(first_language)
                .order_by(fn.Count(PageView.id).desc())
                .tuples())
def languages ( self ) : language = PageView . headers [ 'Accept-Language' ] first_language = fn . SubStr ( language , 1 , fn . StrPos ( language , ';' ) ) return ( self . get_query ( ) . select ( first_language , fn . Count ( PageView . id ) ) . group_by ( first_language ) . order_by ( fn . Count ( PageView . id ) . desc ( ) ) . tuples ( ) )
Retrieve languages, sorted by most common to least common. The
        Accept-Languages header sometimes looks weird, i.e.
        "en-US,en;q=0.8,is;q=0.6,da;q=0.4" We will split on the first semi-
        colon.