@staticmethod
def __ask_for_language(filename, languages):
    """Ask user for language for unknown extension"""
    print(
        "Cannot determine document '%s' type by extension. Select correct type:"
         % filename)
    for i, lang in enumerate(languages):
        print(str.format('  {0}) -> {1}', i + 1, lang))
    language = None
    while not language:
        dtype = input('Enter type number > ')
        try:
            dtype = int(dtype)
            if 1 <= dtype <= len(languages):
                language = languages[dtype - 1]
        except ValueError:
            pass
        if not language:
            print('Invalid value')
    return language
