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.
docstr: Write the episode record and initialize a new one.
docstr_tok: ["Write","the","episode","record","and","initialize","a","new","one","."]
code: def reset(self) -> Any:
      """Write the episode record and initialize a new one."""
      self.write_episode_record()
  
      self.last_observation = self.env.reset()
      self.last_env_time = None
      self.episode_record = SpacesTrajectoryRecord(
          id=self.env.get_episode_id()
      )
  
      return self.last_observation
  
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 2 for calling the SpacesRecordingWrapper obj's underlying member method code with example usage: obj.reset() and returns: self