code: def run_commands_locally(
      commands: Sequence[CommandToLaunch], terminal=None
  ) -> Union[
      worker_manager.WorkerManager, worker_manager_v2.WorkerManager
  ]:
      """Launches a program using multiple processes."""
      # Minimally validate all the commands before executing any of them. This also
      # gives better errors in the case that a terminal implementation executes
      # the commands via a wrapper.
      for command in commands:
          if not os.access(command.command_as_list[0], os.X_OK):
              raise ValueError(
                  "Unable to execute '%s'" % command.command_as_list[0]
              )
      return _LOCAL_LAUNCHER_MAP[_get_terminal(terminal)](commands)
  
file_path: launchpad/launchpad/launch/run_locally/run_locally.py
imports: import collections
  import os
  from typing import Optional, Sequence, Text, Union
  from absl import logging
  from launchpad.launch import worker_manager
  from launchpad.launch import worker_manager_v2
  from launchpad.launch.run_locally import feature_testing
  from launchpad.launch.run_locally import launch_local_current_terminal
  from launchpad.launch.run_locally import launch_local_gnome
  from launchpad.launch.run_locally import launch_local_output_to_files
  from launchpad.launch.run_locally import launch_local_tmux
  from launchpad.launch.run_locally import launch_local_xterm
label_desc: Use image node_id 2 for calling a global function with example usage: run_commands_locally(commands, terminal) and returns: _LOCAL_LAUNCHER_MAP