def find_module(module, path=None, imp=None):
if imp is None:<EOL><INDENT>imp = importlib.import_module<EOL><DEDENT>with cwd_in_path():<EOL><INDENT>if "<STR_LIT:.>" in module:<EOL><INDENT>last = None<EOL>parts = module.split("<STR_LIT:.>")<EOL>for i, part in enumerate(parts[:-<NUM_LIT:1>]):<EOL><INDENT>mpart = imp("<STR_LIT:.>".join(parts[:i + <NUM_LIT:1>]))<EOL>try:<EOL><INDENT>path = mpart.__path__<EOL><DEDENT>except AttributeError:<EOL><INDENT>raise NotAPackage(module)<EOL><DEDENT>last = _imp.find_module(parts[i + <NUM_LIT:1>], path)<EOL><DEDENT>return last<EOL><DEDENT>return _imp.find_module(module)<EOL><DEDENT>
Version of :func:`imp.find_module` supporting dots.