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: Returns single agent data from multi-agent data.
  
  Args:
      agent_id: A string identifying the agent for which the
          data should be extracted.
      ma_data: A List of dictionaries, each containing multi-agent
          data, i.e. mapping from agent ids to timestep data.
      start_index: An integer defining the start point of the
          extration window. The default starts at the beginning of the
          the `ma_data` list.
      end_index: Optional. An integer defining the end point of the
          extraction window. If `None`, the extraction window will be
          until the end of the `ma_data` list.g
      shift: An integer that defines by which amount to shift the
          running index for extraction. This is for example needed
          when we extract data that started at index 1.
  
  Returns: A list containing single-agent data from the multi-agent
      data provided.
code: def _get_single_agent_data(
      self,
      agent_id: str,
      ma_data: List[MultiAgentDict],
      use_global_t_to_local_t: bool = True,
      start_index: int = 0,
      end_index: Optional[int] = None,
      shift: int = 0,
  ) -> List[Any]:
      """Returns single agent data from multi-agent data.
  
      Args:
          agent_id: A string identifying the agent for which the
              data should be extracted.
          ma_data: A List of dictionaries, each containing multi-agent
              data, i.e. mapping from agent ids to timestep data.
          start_index: An integer defining the start point of the
              extration window. The default starts at the beginning of the
              the `ma_data` list.
          end_index: Optional. An integer defining the end point of the
              extraction window. If `None`, the extraction window will be
              until the end of the `ma_data` list.g
          shift: An integer that defines by which amount to shift the
              running index for extraction. This is for example needed
              when we extract data that started at index 1.
  
      Returns: A list containing single-agent data from the multi-agent
          data provided.
      """
      # Should we search along the global timestep mapping, e.g. for observations,
      # or infos.
      if use_global_t_to_local_t:
          # Return all single agent data along the global timestep.
          return [
              singleton[agent_id]
              for singleton in list(
                  map(
                      ma_data.__getitem__,
                      [
                          i + shift
                          for i in self.global_t_to_local_t[agent_id][
                              start_index:end_index
                          ]
                      ],
                  )
              )
              if agent_id in singleton.keys()
          ]
      # Use all. This makes sense in multi-agent games where rewards could be given,
      # even to agents that receive no observation in a timestep.
      else:
          return [
              singleton[agent_id]
              for singleton in ma_data
              if agent_id in singleton
          ]
  
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 25 for calling the MultiAgentEpisode obj's underlying member method code with example usage: obj._get_single_agent_data(agent_id, ma_data, use_global_t_to_local_t, start_index, end_index, shift) and returns: unknown, unknown