def load(directory_name, module_name):
directory_name = os.path.expanduser(directory_name)<EOL>if os.path.isdir(directory_name) and directory_name not in sys.path:<EOL><INDENT>sys.path.append(directory_name)<EOL><DEDENT>try:<EOL><INDENT>return importlib.import_module(module_name)<EOL><DEDENT>except ImportError:<EOL><INDENT>pass<EOL><DEDENT>
Try to load and return a module

    Will add DIRECTORY_NAME to sys.path and tries to import MODULE_NAME.

    For example:
    load("~/.yaz", "yaz_extension")