code: def add_to_cache(cls, remote_info, container):  # pylint: disable=g-bad-name
      
      if not isinstance(container, cls):
        raise TypeError('%r not an instance of %r, could not be added to cache.' %
                        (container, cls))
      if remote_info in cls.__remote_info_cache:
        raise KeyError('Cache has collision but should not.')
      cls.__remote_info_cache[remote_info] = container
docs: Adds a ResourceContainer to a cache tying it to a protorpc method.
  
      Args:
        remote_info: Instance of protorpc.remote._RemoteMethodInfo corresponding
            to a method.
        container: An instance of ResourceContainer.
  
      Raises:
        TypeError: if the container is not an instance of cls.
        KeyError: if the remote method has been reference by a container before.
            This created remote method should never occur because a remote method
            is created once.