import re


def get_lang(hocr, default_lang="fra"):
    """
    Retrieves the most represented language, returns `default_lang` if language is undefined in hocr
    
    Parameters
    ----------
    hocr : str, required
        an hOCR Document
    default_lang: str, optional (default='fra')
        The default language if the language is undefined
    """

    langs = re.findall(r'lang="([a-z]{3})"', hocr)
    if len(langs) == 0:
        return default_lang
    return max(set(langs), key=langs.count)