class_docstr: Records actions, observations, rewards and dones in structured spaces records.
  
  Dumps one trajectory record file per episode.
  
  :param output_dir: Where to dump the serialized trajectory data. Files for individual episodes
                     will be named after the episode ID, with ".pkl" suffix.
code: def __init__(
      self,
      env: Union[gym.Env, MazeEnv],
      output_dir: str = "space_records",
  ):
      super().__init__(env)
  
      self.episode_record: Optional[SpacesTrajectoryRecord] = None
      self.last_observation = Optional[ObservationType]
      self.last_env_time: Optional[int] = None
  
      self.output_dir = Path(output_dir)
  
imports: import pickle
  from pathlib import Path
  from typing import Union, Any, Tuple, Dict, Optional
  import gym
  from maze.core.annotations import override
  from maze.core.env.action_conversion import ActionType
  from maze.core.env.base_env import BaseEnv
  from maze.core.env.maze_action import MazeActionType
  from maze.core.env.maze_env import MazeEnv
  from maze.core.env.maze_state import MazeStateType
  from maze.core.env.observation_conversion import ObservationType
  from maze.core.trajectory_recording.records.spaces_record import SpacesRecord
  from maze.core.trajectory_recording.records.structured_spaces_record import StructuredSpacesRecord
  from maze.core.trajectory_recording.records.trajectory_record import SpacesTrajectoryRecord
  from maze.core.wrappers.wrapper import Wrapper
label_desc: Use image node_id 1 to create a new SpacesRecordingWrapper object from inherited base classes: Wrapper with example: obj = SpacesRecordingWrapper(env, output_dir)