code: def start_controller(
      folder: Path,
      command: str,
      tasks_per_node: int = 1,
      cuda_devices: str = "",
      timeout_min: float = 5.0,
      signal_delay_s: int = 30,
      stderr_to_stdout: bool = False,
      setup: tp.Sequence[str] = (),
  ) -> "subprocess.Popen['bytes']":
      """Starts a job controller, which is expected to survive the end of the python session."""
      env = dict(os.environ)
      env.update(
          SUBMITIT_LOCAL_NTASKS=str(tasks_per_node),
          SUBMITIT_LOCAL_COMMAND=command,
          SUBMITIT_LOCAL_TIMEOUT_S=str(int(60 * timeout_min)),
          SUBMITIT_LOCAL_SIGNAL_DELAY_S=str(int(signal_delay_s)),
          SUBMITIT_LOCAL_NODEID="0",
          SUBMITIT_LOCAL_JOB_NUM_NODES="1",
          SUBMITIT_STDERR_TO_STDOUT="1" if stderr_to_stdout else "",
          SUBMITIT_EXECUTOR="local",
          CUDA_VISIBLE_DEVICES=cuda_devices,
          SUBMITIT_LOCAL_WITH_SHELL="1" if setup else "",
      )
      # The LocalJob will be responsible to polling and ending this process.
      # pylint: disable=consider-using-with
      proc_cmd: tp.Any = [
          sys.executable,
          "-m",
          "submitit.local._local",
          str(folder),
      ]
      need_shell = bool(setup)
      if need_shell:
          proc_cmd = " && ".join(list(setup) + [shlex.join(proc_cmd)])
      process = subprocess.Popen(proc_cmd, shell=need_shell, env=env)
      return process
  
imports: import os
  import shlex
  import signal
  import subprocess
  import sys
  import time
  import typing
  from pathlib import Path
  from ..core import core, job_environment, logger, utils
  from ..core.core import R
label_desc: Use image node_id 1 for calling a global function with example usage: start_controller(folder, command, tasks_per_node, cuda_devices, timeout_min, signal_delay_s, stderr_to_stdout, setup) and returns: process