code: def _make_local_execution_env(
      managed_training: bool,
      test_mode: bool,
      config: Optional[Dict[str, Any]],
      checkpoint_dir: str,
      tensorboard_path: Optional[pathlib.Path] = None,
      hparams: Optional[Dict[str, Any]] = None,
      limit_gpus: Optional[int] = None,
  ) -> Tuple[core.Context, det.EnvContext]:
      config = det.ExperimentConfig(
          _make_local_execution_exp_config(
              config,
              checkpoint_dir,
              managed_training=managed_training,
              test_mode=test_mode,
          )
      )
      hparams = hparams or _generate_random_hparam_values(
          config.get("hyperparameters", {})
      )
      use_gpu, container_gpus, slot_ids = _get_gpus(limit_gpus)
  
      env = det.EnvContext(
          master_url="",
          master_cert_file=None,
          master_cert_name=None,
          experiment_config=config,
          hparams=hparams,
          latest_checkpoint=None,
          steps_completed=0,
          use_gpu=use_gpu,
          container_gpus=container_gpus,
          slot_ids=slot_ids,
          debug=config.debug_enabled(),
          det_trial_id="",
          det_agent_id="",
          det_experiment_id="",
          det_cluster_id="",
          trial_seed=config.experiment_seed(),
          trial_run_id=1,
          allocation_id="",
          managed_training=managed_training,
          test_mode=test_mode,
          on_cluster=False,
      )
  
      core_context = core._dummy_init(tensorboard_path=tensorboard_path)
  
      return core_context, env
  
imports: import contextlib
  import logging
  import math
  import os
  import pathlib
  import random
  import sys
  import uuid
  from typing import Any, Dict, Iterator, List, Optional, Tuple, Type
  import determined
  from determined import constants, core, gpu, load
label_desc: Use image node_id 6 for calling a global function with example usage: _make_local_execution_env(managed_training, test_mode, config, checkpoint_dir, tensorboard_path, hparams, limit_gpus) and returns: core_context,  env