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: Get the all-agent return.
  
  Args:
      consider_buffer; Boolean. Defines, if we should also consider
          buffered rewards wehn calculating return. Agents might
          have received partial rewards, i.e. rewards without an
          observation. These are stored to the buffer and added up
          until the next observation is received by an agent.
  Returns: A float. The aggregate return from all agents.
code: def get_return(self, consider_buffer=False) -> float:
      """Get the all-agent return.
  
      Args:
          consider_buffer; Boolean. Defines, if we should also consider
              buffered rewards wehn calculating return. Agents might
              have received partial rewards, i.e. rewards without an
              observation. These are stored to the buffer and added up
              until the next observation is received by an agent.
      Returns: A float. The aggregate return from all agents.
      """
  
      assert (
          sum(
              len(agent_map)
              for agent_map in self.global_t_to_local_t.values()
          )
          > 0
      ), (
          "ERROR: Cannot determine return of episode that hasn't started, yet!"
          "Call `MultiAgentEpisode.add_env_reset(observations=)` "
          "first (after which `get_return(MultiAgentEpisode)` will be 0)."
      )
      env_return = sum(
          agent_eps.get_return()
          for agent_eps in self.agent_episodes.values()
      )
      # If we should consider buffered partial rewards for agents.
      if consider_buffer:
          buffered_rewards = 0
          for agent_buffer in self.agent_buffers.values():
              if agent_buffer["rewards"].full():
                  agent_buffered_rewards = agent_buffer[
                      "rewards"
                  ].get_nowait()
                  buffered_rewards += agent_buffered_rewards
                  # Write the agent rewards back to the buffer.
                  agent_buffer["rewards"].put_nowait(
                      agent_buffered_rewards
                  )
  
          return env_return + buffered_rewards
      # Otherwise return the sum of recorded rewards from `SingleAgentEpisode`s.
      else:
          return env_return
  
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 18 for calling the MultiAgentEpisode obj's underlying member method code with example usage: obj.get_return(consider_buffer) and returns: unknown, env_return