code: def cartpole_env_factory():
      """Env factory for the cartpole MazeEnv"""
      # Registered gym environments can be instantiated first and then provided to GymMazeEnv:
      cartpole_env = gym.make("CartPole-v0")
      maze_env = GymMazeEnv(env=cartpole_env)
  
      # Another possibility is to supply the gym env string to GymMazeEnv directly:
      maze_env = GymMazeEnv(env="CartPole-v0")
  
      return maze_env
  
imports: from typing import Dict, Sequence
  import gym
  import torch
  import torch.nn
  from maze.core.agent.torch_actor_critic import TorchActorCritic
  from maze.core.agent.torch_policy import TorchPolicy
  from maze.core.agent.torch_state_critic import TorchSharedStateCritic
  from maze.core.rollout.rollout_generator import RolloutGenerator
  from maze.core.wrappers.maze_gym_env_wrapper import GymMazeEnv
  from maze.distributions.distribution_mapper import DistributionMapper
  from maze.perception.blocks.general.torch_model_block import TorchModelBlock
  from maze.train.parallelization.vector_env.sequential_vector_env import SequentialVectorEnv
  from maze.train.trainers.a2c.a2c_algorithm_config import A2CAlgorithmConfig
  from maze.train.trainers.a2c.a2c_trainer import A2C
  from maze.train.trainers.common.evaluators.rollout_evaluator import RolloutEvaluator
  from maze.train.trainers.common.model_selection.best_model_selection import BestModelSelection
  from maze.utils.log_stats_utils import setup_logging
label_desc: Use image node_id 1 for calling a global function with example usage: cartpole_env_factory() and returns: maze_env