code: def find_python():
      
      python = (
          _state.get("pythonExecutable") or
  
          # Support for multiple executables.
          next((
              exe for exe in
              os.getenv("PYBLISH_QML_PYTHON_EXECUTABLE", "").split(os.pathsep)
              if os.path.isfile(exe)), None
          ) or
  
          # Search PATH for executables.
          which("python") or
          which("python3")
      )
  
      if not python or not os.path.isfile(python):
          raise ValueError("Could not locate Python executable.")
  
      return python
docs: Search for Python automatically