code: def _convert_spec(nested_spec: types.NestedSpec) -> types.NestedSpec:
      """Converts all bounded specs in nested spec to the canonical scale."""
  
      def _convert_single_spec(spec: specs.Array) -> specs.Array:
          """Converts a single spec to canonical if bounded."""
          if isinstance(spec, specs.BoundedArray):
              return spec.replace(
                  minimum=-np.ones(spec.shape),
                  maximum=np.ones(spec.shape),
              )
          else:
              return spec
  
      return tree.map_structure(_convert_single_spec, nested_spec)
  
file_path: acme/acme/wrappers/canonical_spec.py
imports: from acme import specs
  from acme import types
  from acme.wrappers import base
  import dm_env
  import numpy
  import tree
label_desc: Use image node_id 1 for calling a global function with example usage: _convert_spec(nested_spec) and returns: tree, spec, spec