def win_find_exe(filename, installsubdir=None, env="ProgramFiles"):
    for fn in [filename, filename+".exe"]:
        try:
            if installsubdir is None:
                path = _where(fn)
            else:
                path = _where(fn, dirs=[os.path.join(os.environ[env], installsubdir)])
        except IOError:
            path = filename
        else:
            break        
    return path
Find executable in current dir, system path or given ProgramFiles subdir
dataset/ETHPy150Open phaethon/scapy/scapy/arch/windows/__init__.py/win_find_exe