code: def _prepare_remote_environment(
      test: Test,
      command_runner: CommandRunner,
      prepare_cmd: bool,
      prepare_timeout: int,
  ) -> None:
      command_runner.prepare_remote_env()
  
      wait_for_nodes = test["run"].get("wait_for_nodes", None)
  
      if wait_for_nodes:
          buildkite_group(":stopwatch: Waiting for nodes to come up")
          # Overwrite wait_timeout from above to account for better default
          wait_timeout = int(
              wait_for_nodes.get(
                  "timeout", DEFAULT_WAIT_FOR_NODES_TIMEOUT
              )
          )
          num_nodes = test["run"]["wait_for_nodes"]["num_nodes"]
          command_runner.wait_for_nodes(num_nodes, wait_timeout)
  
      if prepare_cmd:
          try:
              command_runner.run_prepare_command(
                  prepare_cmd, timeout=prepare_timeout
              )
          except CommandError as e:
              raise PrepareCommandError(e)
          except CommandTimeout as e:
              raise PrepareCommandTimeout(e)
  
imports: import os
  import time
  import traceback
  from typing import Optional, List, Tuple
  from ray_release.alerts.handle import handle_result, require_result
  from ray_release.anyscale_util import get_cluster_name
  from ray_release.buildkite.output import buildkite_group, buildkite_open_last
  from ray_release.cluster_manager.cluster_manager import ClusterManager
  from ray_release.cluster_manager.full import FullClusterManager
  from ray_release.cluster_manager.minimal import MinimalClusterManager
  from ray_release.command_runner.job_runner import JobRunner
  from ray_release.command_runner.command_runner import CommandRunner
  from ray_release.command_runner.anyscale_job_runner import AnyscaleJobRunner
  from ray_release.test import Test
  from ray_release.config import DEFAULT_BUILD_TIMEOUT, DEFAULT_CLUSTER_TIMEOUT, DEFAULT_COMMAND_TIMEOUT, DEFAULT_WAIT_FOR_NODES_TIMEOUT, RELEASE_PACKAGE_DIR, DEFAULT_AUTOSUSPEND_MINS
  from ray_release.template import load_test_cluster_compute
  from ray_release.exception import ReleaseTestConfigError, ReleaseTestSetupError, CommandError, PrepareCommandError, CommandTimeout, PrepareCommandTimeout, TestCommandError, TestCommandTimeout, ClusterEnvCreateError
  from ray_release.file_manager.job_file_manager import JobFileManager
  from ray_release.logger import logger
  from ray_release.reporter.reporter import Reporter
  from ray_release.result import Result, ResultStatus, handle_exception
  from ray_release.signal_handling import setup_signal_handling, reset_signal_handling, register_handler
label_desc: Use image node_id 5 for calling a global function with example usage: _prepare_remote_environment(test, command_runner, prepare_cmd, prepare_timeout) without return types