def import_name(mod_name):
    """Import a module by module name.

    @param mod_name: module name.
    """
    try:
        mod_obj_old = sys.modules[mod_name]
    except KeyError:
        mod_obj_old = None

    if mod_obj_old is not None:
        return mod_obj_old

    __import__(mod_name)

    mod_obj = sys.modules[mod_name]

    return mod_obj
Import a module by module name.

    @param mod_name: module name.