def which(program):
<EOL>if os.path.split(program)[<NUM_LIT:0>]:<EOL><INDENT>if os.path.exists(program) and os.access(program, os.X_OK):<EOL><INDENT>return program<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for path in os.environ['<STR_LIT>'].split(os.pathsep):<EOL><INDENT>progpath = os.path.join(path, program)<EOL>if os.path.exists(progpath) and os.access(progpath, os.X_OK):<EOL><INDENT>return progpath<EOL><DEDENT><DEDENT><DEDENT>return None<EOL>
look for "program" in PATH, and return the path to it, or None if it
        was not found