def import_from_source(module_filepath):
import sys<EOL>if not os.path.exists(module_filepath):<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>".format(module_filepath))<EOL><DEDENT>fname_chars = string.ascii_letters + string.digits<EOL>name = "<STR_LIT>".join(random.choice(fname_chars) for _ in range(<NUM_LIT:20>))<EOL>if sys.version_info >= (<NUM_LIT:3>, <NUM_LIT:5>):<EOL><INDENT>from importlib import util as _il_util<EOL>modspec = _il_util.spec_from_file_location(<EOL>name, module_filepath)<EOL>mod = _il_util.module_from_spec(modspec)<EOL>modspec.loader.exec_module(mod)<EOL><DEDENT>elif sys.version_info < (<NUM_LIT:3>, <NUM_LIT:3>):<EOL><INDENT>import imp<EOL>mod = imp.load_source(name, module_filepath)<EOL><DEDENT>else:<EOL><INDENT>from importlib import machinery as _il_mach<EOL>loader = _il_mach.SourceFileLoader(name, module_filepath)<EOL>mod = loader.load_module()<EOL><DEDENT>return mod<EOL>
Import a module from a particular filesystem location.

:param str module_filepath: path to the file that constitutes the module
    to import
:return module: module imported from the given location, named as indicated
:raises ValueError: if path provided does not point to an extant file