def lookupmodule(self, filename):
if os.path.isabs(filename) and os.path.exists(filename):<EOL><INDENT>return filename<EOL><DEDENT>f = os.path.join(sys.path[<NUM_LIT:0>], filename)<EOL>if os.path.exists(f) and self.canonic(f) == self.mainpyfile:<EOL><INDENT>return f<EOL><DEDENT>root, ext = os.path.splitext(filename)<EOL>origFileName = filename<EOL>if ext == '<STR_LIT>':<EOL><INDENT>filename = filename + '<STR_LIT>'<EOL><DEDENT>if os.path.isabs(filename):<EOL><INDENT>return filename<EOL><DEDENT>for dirname in sys.path:<EOL><INDENT>while os.path.islink(dirname):<EOL><INDENT>dirname = os.path.realpath(os.path.join(<EOL>os.path.dirname(dirname),<EOL>os.readlink(dirname)))<EOL><DEDENT>fullname = os.path.join(dirname, filename)<EOL>if os.path.exists(fullname):<EOL><INDENT>return fullname<EOL><DEDENT><DEDENT>if origFileName in sys.modules:<EOL><INDENT>return sys.modules[origFileName].__file__<EOL><DEDENT>return None<EOL>
Helper function for break/clear parsing -- may be overridden.

        lookupmodule() translates (possibly incomplete) file or module name
        into an absolute file name.