code: def test_ssh_waitpid(capsys):
      proc = Popen([sys.executable, "-c", "import time; time.sleep(1)"])
      pid = proc.pid
  
      def _wait_one(timeout):
          launcher_mod.ssh_waitpid(pid, timeout=timeout)
          captured = capsys.readouterr()
          return launcher_mod._ssh_outputs(captured.out)
  
      # first run, it's alive
      assert _wait_one(timeout=0.1) == {"process_running": "1"}
      # second run, process exits
      assert _wait_one(timeout=5) == {
          "process_running": "0",
          "exit_code": "-1",
      }
      # third run, process has already exited
      assert _wait_one(timeout=5) == {
          "process_running": "0",
          "exit_code": "-1",
      }
  
imports: import logging
  import os
  import sys
  import time
  from subprocess import Popen
  import entrypoints
  import pytest
  from traitlets.config import Config
  from ipyparallel.cluster import launcher
label_desc: Use image node_id 14 for calling a global function with example usage: test_ssh_waitpid(capsys) and returns: launcher_mod