class_docstr: Maps policy IDs to Policy objects.
  
  Thereby, keeps n policies in memory and - when capacity is reached -
  writes the least recently used to disk. This allows adding 100s of
  policies to a Algorithm for league-based setups w/o running out of memory.
code: def __getitem__(self, item: PolicyID):
      # Never seen this key -> Error.
      if item not in self._valid_keys:
          raise KeyError(
              f"PolicyID '{item}' not found in this PolicyMap! "
              f"IDs stored in this map: {self._valid_keys}."
          )
  
      # Item already in cache -> Rearrange deque (promote `item` to
      # "most recently used") and return it.
      if item in self.cache:
          self._deque.remove(item)
          self._deque.append(item)
          return self.cache[item]
  
      # Item not currently in cache -> Get from stash and - if at capacity -
      # remove leftmost one.
      if item not in self._policy_state_refs:
          raise AssertionError(
              f"PolicyID {item} not found in internal Ray object store cache!"
          )
      policy_state = ray.get(self._policy_state_refs[item])
  
      policy = None
      # We are at capacity: Remove the oldest policy from deque as well as the
      # cache and return it.
      if len(self._deque) == self.capacity:
          policy = self._stash_least_used_policy()
  
      # All our policies have same NN-architecture (are "swappable").
      # -> Load new policy's state into the one that just got removed from the cache.
      # This way, we save the costly re-creation step.
      if policy is not None and self.policy_states_are_swappable:
          logger.debug(f"restoring policy: {item}")
          policy.set_state(policy_state)
      else:
          logger.debug(f"creating new policy: {item}")
          policy = Policy.from_state(policy_state)
  
      self.cache[item] = policy
      # Promote the item to most recently one.
      self._deque.append(item)
  
      return policy
  
imports: from collections import deque
  import threading
  from typing import Dict, Set
  import logging
  import ray
  from ray.rllib.policy.policy import Policy
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.deprecation import deprecation_warning
  from ray.rllib.utils.framework import try_import_tf
  from ray.rllib.utils.threading import with_lock
  from ray.rllib.utils.typing import PolicyID
  from ray.util.annotations import PublicAPI
label_desc: Use image node_id 2 for calling the PolicyMap obj's underlying member method code with example usage: obj.__getitem__(item) and returns: policy, self