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: Build a new episode record with episode ID from the env (if provided) or generated one (if not provided).
docstr_tok: ["Build","a","new","episode","record","with","episode","ID","from","the","env","(","if","provided",")","or","generated","one","(","if","not","provided",")","."]
code: def _build_episode_record(self) -> StateTrajectoryRecord:
      """Build a new episode record with episode ID from the env (if provided) or generated one (if not provided)."""
      if isinstance(self.env, RecordableEnvMixin):
          episode_id = self.env.get_episode_id()
          renderer = self.env.get_renderer()
      else:
          episode_id = str(uuid.uuid4())
          renderer = None
  
      return StateTrajectoryRecord(episode_id, renderer)
  
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 8 for calling the TrajectoryRecordingWrapper obj's underlying member method code with example usage: obj._build_episode_record() and returns: StateTrajectoryRecord