def whence_file(py_script, dirnames=None):
if py_script.find(os.sep) != -<NUM_LIT:1>:<EOL><INDENT>return py_script<EOL><DEDENT>if dirnames is None:<EOL><INDENT>dirnames = os.environ['<STR_LIT>'].split(os.pathsep)<EOL><DEDENT>for dirname in dirnames:<EOL><INDENT>py_script_try = osp.join(dirname, py_script)<EOL>if osp.exists(py_script_try):<EOL><INDENT>return py_script_try<EOL><DEDENT><DEDENT>return py_script<EOL>
Do a shell-like path lookup for py_script and return the results.
    If we can't find anything return py_script