class_docstr: Stores multi-agent episode data.
  
  The central attribute of the class is the timestep mapping
  `global_t_to_local_t` that maps the global (environment)
  timestep to the local (agent) timesteps.
  
  The `MultiAgentEpisode` is based on the `SingleAgentEpisode`s
  for each agent, stored in `MultiAgentEpisode.agent_episodes`.
class_docstr_tok: ["Stores","multi-agent","episode","data",".","The","central","attribute","of","the","class","is","the","timestep","mapping","`","global_t_to_local_t","`","that","maps","the","global","(","environment",")","timestep","to","the","local","(","agent",")","timesteps",".","The","`","MultiAgentEpisode","`","is","based","on","the","`","SingleAgentEpisode","`","s","for","each","agent",",","stored","in","`","MultiAgentEpisode.agent_episodes","`","."]
docstr: Converts a `MultiAgentEpisode` into a `MultiAgentBatch`.
  
  Each `SingleAgentEpisode` instances in
  `MultiAgentEpisode.agent_epiosdes` will be converted into
  a `SampleBatch` and the environment timestep will be passed
  towards the `MultiAgentBatch`'s `count`.
  
  Returns: A `MultiAgentBatch` instance.
code: def to_sample_batch(self) -> MultiAgentBatch:
      """Converts a `MultiAgentEpisode` into a `MultiAgentBatch`.
  
      Each `SingleAgentEpisode` instances in
      `MultiAgentEpisode.agent_epiosdes` will be converted into
      a `SampleBatch` and the environment timestep will be passed
      towards the `MultiAgentBatch`'s `count`.
  
      Returns: A `MultiAgentBatch` instance.
      """
      # TODO (simon): Check, if timesteps should be converted into global
      # timesteps instead of agent steps.
      # Note, only agents that have stepped are included into the batch.
      return MultiAgentBatch(
          policy_batches={
              agent_id: agent_eps.get_sample_batch()
              for agent_id, agent_eps in self.agent_episodes.items()
              if agent_eps.t - agent_eps.t_started > 0
          },
          env_steps=self.t - self.t_started,
      )
  
imports: from collections import defaultdict
  from queue import Queue
  from typing import Any, Dict, List, Optional, Set, Union
  import uuid
  import numpy
  from ray.rllib.env.single_agent_episode import SingleAgentEpisode
  from ray.rllib.policy.sample_batch import MultiAgentBatch
  from ray.rllib.utils.typing import MultiAgentDict
label_desc: Use image node_id 17 for calling the MultiAgentEpisode obj's underlying member method code with example usage: obj.to_sample_batch() and returns: MultiAgentBatch