code: def make_env_from_output_dir(path: Union[Path, str]) -> MazeEnv:
      """Create an environment instance from an output directory of a previous run. The
      directory is expected to contain the hydra config of the run and all associated
      information needed for the env (like observation normalization statistics).
  
      :param path: Path of the output directory to use
      :return: The newly instantiated environment
      """
      with SwitchWorkingDirectoryToInput(path):
          cfg = read_config("hydra_config.yaml")
          env = EnvFactory(
              cfg["env"], cfg["wrappers"] if "wrappers" in cfg else {}
          )()
      return env
  
imports: import os
  from pathlib import Path
  from typing import Mapping, Union, Sequence
  import hydra
  import yaml
  from hydra import initialize_config_module, compose
  from hydra.core.hydra_config import HydraConfig
  from omegaconf import DictConfig
  from maze.core.agent.serialized_torch_policy import SerializedTorchPolicy
  from maze.core.env.maze_env import MazeEnv
  from maze.core.utils.factory import Factory, ConfigType, CollectionOfConfigType
  from maze.core.wrappers.wrapper_factory import WrapperFactory
label_desc: Use image node_id 7 for calling a global function with example usage: make_env_from_output_dir(path) and returns: env