def lookupmodule(name):
if sys.modules.get(name):<EOL><INDENT>return (sys.modules[name], sys.modules[name].__file__)<EOL><DEDENT>if os.path.isabs(name) and readable(name):<EOL><INDENT>return (None, name)<EOL><DEDENT>f = os.path.join(sys.path[<NUM_LIT:0>], name)<EOL>if readable(f):<EOL><INDENT>return (None, f)<EOL><DEDENT>root, ext = os.path.splitext(name)<EOL>if ext == '<STR_LIT>':<EOL><INDENT>name = name + '<STR_LIT>'<EOL>pass<EOL><DEDENT>if os.path.isabs(name):<EOL><INDENT>return (None, name)<EOL><DEDENT>for dirname in sys.path:<EOL><INDENT>while os.path.islink(dirname):<EOL><INDENT>dirname = os.readlink(dirname)<EOL>pass<EOL><DEDENT>fullname = os.path.join(dirname, name)<EOL>if readable(fullname):<EOL><INDENT>return (None, fullname)<EOL><DEDENT>pass<EOL><DEDENT>return (None, None)<EOL>
lookupmodule()->(module, file) translates a possibly incomplete
    file or module name into an absolute file name. None can be
    returned for either of the values positions of module or file when
    no or module or file is found.