code: def which(file):
      
      for path in os.environ["PATH"].split(os.pathsep):
          if os.path.exists(os.path.join(path, file)):
                  return os.path.join(path, file)
      return None
docs: >>> which("sh") is not None
      True
  
      >>> which("bogus-executable-that-doesn't-exist") is None
      True