class_docstr: Environment wrapper for Multigrid environments.
  
  Note: the main difference with vanilla GymWrapper is that reward_spec() is
  overridden and rewards are cast to np.arrays in step()
docstr: Initializes environment.
  
  Args:
    environment: the environment.
docstr_tok: ["Initializes","environment",".","Args",":","environment",":","the","environment","."]
code: def __init__(self, environment: multigrid.MultiGridEnv):
      """Initializes environment.
  
      Args:
        environment: the environment.
      """
      self._environment = environment
      self._reset_next_step = True
      self._last_info = None
      self.num_agents = (
          environment.n_agents
      )  # pytype: disable=attribute-error
  
      # Convert action and observation specs.
      obs_space = self._environment.observation_space
      act_space = self._environment.action_space
      self._observation_spec = _convert_to_spec(
          obs_space, self.num_agents, name="observation"
      )
      self._action_spec = _convert_to_spec(
          act_space, self.num_agents, name="action"
      )
  
imports: from typing import Any, Dict, List, Optional
  import warnings
  from acme import specs
  from acme import types
  from acme import wrappers
  from acme.multiagent import types
  from acme.wrappers import multiagent_dict_key_wrapper
  import dm_env
  import gym
  from gym import spaces
  import jax
  import numpy
  import tree
label_desc: Use image node_id 1 to create a new MultigridWrapper object from inherited base classes: dm_env with example: obj = MultigridWrapper(environment)