class_docstr: Encapsulates multiple torch policies along with a distribution mapper for training and rollouts
  in structured environments.
  
  :param networks: Mapping of policy networks to encapsulate
  :param distribution_mapper: Distribution mapper associated with the policy mapping.
  :param device: Device the policy should be located on (cpu or cuda)
class_docstr_tok: ["Encapsulates","multiple","torch","policies","along","with","a","distribution","mapper","for","training","and","rollouts","in","structured","environments",".",":","param","networks",":","Mapping","of","policy","networks","to","encapsulate",":","param","distribution_mapper",":","Distribution","mapper","associated","with","the","policy","mapping",".",":","param","device",":","Device","the","policy","should","be","located","on","(","cpu","or","cuda",")"]
docstr: Helper function for returning a network for the given policy ID (using either just the sub-step ID
  or the full Actor ID as key, depending on the separated agent networks mode.
  
  :param actor_id: Actor ID to get a network for
  :return: Network corresponding to the given policy ID.
docstr_tok: ["Helper","function","for","returning","a","network","for","the","given","policy","ID","(","using","either","just","the","sub-step","ID","or","the","full","Actor","ID","as","key",",","depending","on","the","separated","agent","networks","mode",".",":","param","actor_id",":","Actor","ID","to","get","a","network","for",":","return",":","Network","corresponding","to","the","given","policy","ID","."]
code: def network_for(self, actor_id: Optional[ActorID]) -> nn.Module:
      """Helper function for returning a network for the given policy ID (using either just the sub-step ID
      or the full Actor ID as key, depending on the separated agent networks mode.
  
      :param actor_id: Actor ID to get a network for
      :return: Network corresponding to the given policy ID.
      """
      if actor_id is None:
          assert (
              len(self.networks) == 1
          ), "multiple networks are available, please specify the actor ID explicitly"
          return list(self.networks.values())[0]
  
      network_key = (
          actor_id
          if actor_id.step_key in self.substeps_with_separate_agent_nets
          else actor_id.step_key
      )
      return self.networks[network_key]
  
imports: from typing import Mapping, Union, List, Dict, Tuple, Sequence, Optional
  import torch
  from torch import nn
  from maze.core.agent.policy import Policy
  from maze.core.agent.torch_model import TorchModel
  from maze.core.agent.torch_policy_output import PolicySubStepOutput, PolicyOutput
  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_state import MazeStateType
  from maze.core.env.observation_conversion import ObservationType
  from maze.core.env.structured_env import ActorID, StepKeyType
  from maze.core.trajectory_recording.records.structured_spaces_record import StructuredSpacesRecord
  from maze.distributions.categorical import CategoricalProbabilityDistribution
  from maze.distributions.distribution_mapper import DistributionMapper
  from maze.perception.perception_utils import convert_to_torch, convert_to_numpy
label_desc: Use image node_id 12 for calling the TorchPolicy obj's underlying member method code with example usage: obj.network_for(actor_id) and returns: self, list