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: Record available step-level data.
docstr_tok: ["Record","available","step-level","data","."]
code: def step(
      self, action: ActionType
  ) -> Tuple[ObservationType, Any, bool, Dict[Any, Any]]:
      """Record available step-level data."""
      assert (
          self.episode_record is not None
      ), "Environment must be reset before stepping."
  
      # If the env time changed, start a new structured step record
      if self.env.get_env_time() != self.last_env_time:
          self.episode_record.step_records.append(
              StructuredSpacesRecord()
          )
          self.last_env_time = self.env.get_env_time()
  
      actor_id = (
          self.env.actor_id()
      )  # Get actor Id before the step, so it corresponds to the action taken
      observation, reward, done, info = self.env.step(action)
  
      # Record the spaces of the current (sub)step
      self.episode_record.step_records[-1].append(
          SpacesRecord(
              actor_id=actor_id,
              observation=self.last_observation,
              action=action,
              reward=reward,
              done=done,
              info=info,
          )
      )
  
      self.last_observation = observation
      return observation, reward, done, info
  
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 3 for calling the SpacesRecordingWrapper obj's underlying member method code with example usage: obj.step(action) and returns: observation,  reward,  done,  info