code: def run_reproducible_rollout(
      env: MazeEnv, pick_action: Callable, n_steps: int = 100
  ) -> List[ObservationType]:
      """
      Runs specified environment with specified callback to pick action.
  
      :param env: Initialized MazeEnv instance.
      :param pick_action: Reference to function choosing which action to take.
      :param n_steps: Number of steps to run.
      :return: A list of observations collected along the way.
      """
      env.seed(1234)
  
      # seed the ActionConversion spaces
      act_conv_spaces = dict()
      for (
          policy_id,
          policy_act_conv,
      ) in env.action_conversion_dict.items():
          # Get transformation spaces.
          policy_space = policy_act_conv.space()
          # Set randomization seed.
          policy_space.seed(1234)
  
          act_conv_spaces[policy_id] = policy_space
  
      # Store hashed step states.
      observations: List[ObservationType] = list()
  
      env.reset()
      for step in range(n_steps):
          policy_id, actor_id = env.actor_id()
  
          # Select next action.
          action = pick_action(
              observation=env.observation_conversion.maze_to_space(
                  env.core_env.get_maze_state()
              ),
              action_space=act_conv_spaces[policy_id],
          )
  
          # Execute action, collect state information.
          observations.append(env.step(action)[0])
  
      return observations
  
file_path: maze/maze/test/shared_test_utils/reproducibility.py
imports: import base64
  import hashlib
  from typing import Any, Tuple, Callable, List, Optional
  import numpy
  from maze.core.agent.policy import Policy
  from maze.core.env.maze_env import MazeEnv
  from maze.core.env.observation_conversion import ObservationType
label_desc: Use image node_id 4 for calling a global function with example usage: run_reproducible_rollout(env, pick_action, n_steps) and returns: observations