code: def validate_spaces(
      policy: Policy,
      observation_space: gym.spaces.Space,
      action_space: gym.spaces.Space,
  ) -> None:
      if not isinstance(action_space, gym.spaces.Box):
          raise UnsupportedSpaceException(
              "Action space ({}) of {} is not supported for "
              "DDPG.".format(action_space, policy)
          )
      elif len(action_space.shape) > 1:
          raise UnsupportedSpaceException(
              "Action space ({}) of {} has multiple dimensions "
              "{}. ".format(action_space, policy, action_space.shape)
              + "Consider reshaping this into a single dimension, "
              "using a Tuple action space, or the multi-agent API."
          )
  
file_path: ray/rllib_contrib/ddpg/src/rllib_ddpg/ddpg/utils.py
imports: import gymnasium
  import numpy
  from rllib_ddpg.ddpg.ddpg_tf_model import DDPGTFModel
  from rllib_ddpg.ddpg.ddpg_torch_model import DDPGTorchModel
  from rllib_ddpg.ddpg.noop_model import NoopModel, TorchNoopModel
  from ray.rllib import Policy
  from ray.rllib.models import ModelV2
  from ray.rllib.models.catalog import ModelCatalog
  from ray.rllib.utils.error import UnsupportedSpaceException
label_desc: Use image node_id 2 for calling a global function with example usage: validate_spaces(policy, observation_space, action_space) without return types