class_docstr: A trajectory recording wrapper. Supports both standard gym envs and BaseEnvs, as well as environments
  that provide more access -- SerializableEnvMixin for access to environment components
  and RecordableEnvMixin for access to MazeState and MazeExecution objects.
  
  :param env: the environment to wrap.
class_docstr_tok: ["A","trajectory","recording","wrapper",".","Supports","both","standard","gym","envs","and","BaseEnvs",",","as","well","as","environments","that","provide","more","access","--","SerializableEnvMixin","for","access","to","environment","components","and","RecordableEnvMixin","for","access","to","MazeState","and","MazeExecution","objects",".",":","param","env",":","the","environment","to","wrap","."]
docstr: Avoid calling this constructor directly, use :method:`wrap` instead.
docstr_tok: ["Avoid","calling","this","constructor","directly",",","use",":","method",":","`","wrap","`","instead","."]
code: def __init__(self, env: MazeEnv):
      """Avoid calling this constructor directly, use :method:`wrap` instead."""
      # BaseEnv is a subset of gym.Env
      super().__init__(env)
  
      self.episode_record: Optional[StateTrajectoryRecord] = None
  
      self.last_env_time: Optional[int] = None
      self.last_maze_state: Optional[MazeStateType] = None
      self.last_serializable_components: Optional[Dict[str, Any]] = None
  
      # Recording of maze actions with support for step-skipping
      self._last_maze_action_before_skipping = None  # Last maze action taken before step-skipping started (if in use)
      self._maze_action_recorded = False  # Flag used for avoiding recording of actions issued during step skipping
  
      # Post-step hook, to be able to record the maze action after it's been converted in MazeEnv,
      # but before step skipping starts
      self.env.context.register_post_step(self._record_last_action)
  
imports: import uuid
  from copy import deepcopy
  from typing import Union, Any, Tuple, Dict, Optional
  from maze.core.annotations import override
  from maze.core.env.base_env import BaseEnv
  from maze.core.env.event_env_mixin import EventEnvMixin
  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.recordable_env_mixin import RecordableEnvMixin
  from maze.core.env.serializable_env_mixin import SerializableEnvMixin
  from maze.core.env.simulated_env_mixin import SimulatedEnvMixin
  from maze.core.env.time_env_mixin import TimeEnvMixin
  from maze.core.events.event_collection import EventCollection
  from maze.core.log_events.step_event_log import StepEventLog
  from maze.core.rendering.keyboard_controlled_trajectory_viewer import KeyboardControlledTrajectoryViewer
  from maze.core.trajectory_recording.records.raw_maze_state import RawState, RawMazeAction
  from maze.core.trajectory_recording.records.state_record import StateRecord
  from maze.core.trajectory_recording.records.trajectory_record import StateTrajectoryRecord
  from maze.core.trajectory_recording.writers.trajectory_writer_registry import TrajectoryWriterRegistry
  from maze.core.wrappers.wrapper import Wrapper
label_desc: Use image node_id 1 to create a new TrajectoryRecordingWrapper object from inherited base classes: Wrapper with example: obj = TrajectoryRecordingWrapper(env)