A backport of the which function from Python 3.3's shutil. which returns the path to an executable which would be run if the given cmd was called.