code: def _expand_scalar_spec_shape(spec: specs.Array) -> specs.Array:
      if not spec.shape:
          # NOTE: This line upcasts the spec to an Array to avoid edge cases (as in
          # DiscreteSpec) where we cannot set the spec's shape.
          spec = specs.Array(
              shape=(1,), dtype=spec.dtype, name=spec.name
          )
      return spec
  
file_path: acme/acme/wrappers/expand_scalar_observation_shapes.py
imports: from typing import Any
  from acme.wrappers import base
  import dm_env
  from dm_env import specs
  import numpy
  import tree
label_desc: Use image node_id 1 for calling a global function with example usage: _expand_scalar_spec_shape(spec) and returns: spec