code: def which_with_envpath(executable: str, env: Dict[str, str]) -> str:
      
      oldpath = os.environ.get("PATH", "")
      os.environ["PATH"] = env.get("PATH")
      which = shutil.which(executable)
      os.environ["PATH"] = oldpath
      return which
docs: Performs a :func:`shutil.which` command using the PATH from the specified
      environment.
  
      Reason: when you use ``run([executable, ...], env)`` and therefore
      ``subprocess.run([executable, ...], env=env)``, the PATH that's searched
      for ``executable`` is the parent's, not the new child's -- so you have to
      find the executable manually.
  
      Args:
          executable: executable to find
          env: environment to fetch the PATH variable from