def findfile(file, here=__file__):
if os.path.isabs(file):<EOL><INDENT>return file<EOL><DEDENT>path = sys.path<EOL>path = [os.path.dirname(here)] + path<EOL>for dn in path:<EOL><INDENT>fn = os.path.join(dn, file)<EOL>if os.path.exists(fn): return fn<EOL><DEDENT>return file<EOL>
Try to find a file on sys.path and the working directory.  If it is not
    found the argument passed to the function is returned (this does not
    necessarily signal failure; could still be the legitimate path).