code: def _spec_to_box(spec):
      def extract_min_max(s):
          assert s.dtype == np.float64 or s.dtype == np.float32
          dim = np.int_(np.prod(s.shape))
          if type(s) == specs.Array:
              bound = np.inf * np.ones(dim, dtype=np.float32)
              return -bound, bound
          elif type(s) == specs.BoundedArray:
              zeros = np.zeros(dim, dtype=np.float32)
              return s.minimum + zeros, s.maximum + zeros
  
      mins, maxs = [], []
      for s in spec:
          mn, mx = extract_min_max(s)
          mins.append(mn)
          maxs.append(mx)
      low = np.concatenate(mins, axis=0)
      high = np.concatenate(maxs, axis=0)
      assert low.shape == high.shape
      return spaces.Box(low, high, dtype=np.float32)
  
file_path: ray/rllib/env/wrappers/dm_control_wrapper.py
imports: from gymnasium import core, spaces
  import numpy
  from ray.rllib.utils.annotations import PublicAPI
label_desc: Use image node_id 1 for calling a global function with example usage: _spec_to_box(spec) and returns: spaces, unknown,  bound, unknown,  unknown