code: def analyze_action_space(
      action_space,
  ):  # pylint: disable=invalid-name
      """Returns the number of controls and actions for an action space."""
      assert isinstance(
          action_space, (gym.spaces.Discrete, gym.spaces.MultiDiscrete)
      ), "Action space expected to be Discrete of MultiDiscrete, got {}.".format(
          type(action_space)
      )
      if isinstance(action_space, gym.spaces.Discrete):
          n_actions = action_space.n
          n_controls = 1
      else:
          (n_controls,) = action_space.nvec.shape
          assert n_controls > 0
          assert np.min(action_space.nvec) == np.max(
              action_space.nvec
          ), "Every control must have the same number of actions."
          n_actions = action_space.nvec[0]
      return (n_controls, n_actions)
  
imports: import functools
  import gym
  import numpy
  from trax import layers
  from trax.fastmath import numpy
  from trax.rl import space_serializer
label_desc: Use image node_id 11 for calling a global function with example usage: analyze_action_space(action_space) and returns: n_controls,  n_actions