# -*- coding: utf-8 -*-
"""__init__.py: Language-dependent features.
"""

module_cache = {}

def get_language(lang_code):
    """Return module with language localizations.

    This is a poor copy of the language framework of Docutils.
    """

    if lang_code in module_cache:
        return module_cache[lang_code]

    for i in (1, 0):
        try:
            module = __import__(lang_code, globals(), locals(), level=i)
            break
        except ImportError:
            continue
    else:
        module = __import__('en', globals(), locals(), level=1)

    module_cache[lang_code] = module
    return module

# -*- coding: utf-8 -*-
"""__init__.py: Language-dependent features.
"""

from importlib import import_module

module_cache = {}

def get_language(lang_code):
    """Return module with language localizations.

    This is a revamped version of function docutils.languages.get_language.
    """

    if lang_code in module_cache:
        return module_cache[lang_code]

    try:
        module = import_module('.' + lang_code, __name__)
    except ImportError:
        from . import en
        module = en

    module_cache[lang_code] = module
    return module

Use importlib.import_module instead of built-in __import__.