def code_to_names(category, code):
    """
    Given the code for a language, script, or region, get a dictionary of its
    names in various languages.
    """
    trie_name = '{}_to_name'.format(category)
    if trie_name not in TRIES:
        TRIES[trie_name] = load_trie(data_filename('trie/{}.marisa'.format(trie_name)))

    trie = TRIES[trie_name]
    lookup = code.lower() + '@'
    possible_keys = trie.keys(lookup)
    names = {}
    for key in possible_keys:
        target_language = key.split('@')[1]
        names[target_language] = get_trie_value(trie, key)
    return names
def code_to_names ( category , code ) : trie_name = '{}_to_name' . format ( category ) if trie_name not in TRIES : TRIES [ trie_name ] = load_trie ( data_filename ( 'trie/{}.marisa' . format ( trie_name ) ) ) trie = TRIES [ trie_name ] lookup = code . lower ( ) + '@' possible_keys = trie . keys ( lookup ) names = { } for key in possible_keys : target_language = key . split ( '@' ) [ 1 ] names [ target_language ] = get_trie_value ( trie , key ) return names
Given the code for a language, script, or region, get a dictionary of its
    names in various languages.