code: def maze_run(cfg: DictConfig) -> Optional[float]:
      """
      Run a CLI task based on the provided configuration.
  
      A runner object is instantiated according to the config (cfg.runner) and it is then handed
      the whole configuration object (cfg). Runners can perform various tasks such as rollouts, trainings etc.
  
      :param cfg: Hydra configuration for the rollout.
      :return: In case of a multirun it returns the maximum mean reward (required for hyper parameter optimization).
               For regular runs nothing is returned.
      """
  
      # check if we are currently in a --multirun
      instance = HydraConfig.instance()
      is_multi_run = (
          instance.cfg is not None
          and instance.cfg.hydra.job.get("num") is not None
      )
  
      # regular single runs
      if not is_multi_run:
          _run_job(cfg)
      # multirun (e.g., gird search, nevergrad, ...)
      else:
          max_mean_reward = _run_multirun_job(cfg)
          return max_mean_reward
  
file_path: maze/maze/maze_cli.py
imports: import glob
  import os
  from typing import Optional
  import hydra
  import matplotlib
  import numpy
  import yaml
  from hydra.core.hydra_config import HydraConfig
  from omegaconf import DictConfig, OmegaConf
  from maze.core.log_stats.hparam_writer_tensorboard import manipulate_hparams_logging_for_exp
  from maze.core.utils.factory import Factory
  from maze.core.utils.seeding import MazeSeeding
  from maze.runner import Runner
  from maze.utils.bcolors import BColors
  from maze.utils.log_stats_utils import clear_global_state
  from maze.utils.tensorboard_reader import tensorboard_to_pandas
label_desc: Use image node_id 4 for calling a global function with example usage: maze_run(cfg) and returns: max_mean_reward