def find_in_paths(name, paths):
for path in paths:<EOL><INDENT>file_ = osp.join(path, name)<EOL>if osp.exists(file_) and not osp.isdir(file_):<EOL><INDENT>abs_file = osp.abspath(file_)<EOL>if os.access(file_, os.X_OK):<EOL><INDENT>return abs_file<EOL><DEDENT><DEDENT><DEDENT>
Find an executable is a list of directories
    :return: absolute path to the first location where the executable
    is found, ``None`` otherwise.
    :rtype: string