code: def _numeric_to_spec(x: Union[float, int, np.ndarray]):
      if isinstance(x, np.ndarray):
          return specs.Array(shape=x.shape, dtype=x.dtype)
      elif isinstance(x, (float, int)):
          return specs.Array(shape=(), dtype=type(x))
      else:
          raise ValueError(f"Unsupported numeric: {type(x)}")
  
imports: from typing import Any, Callable, Optional, Sequence, Tuple, TypeVar, Union
  from acme import specs
  from acme import types
  from acme.adders import base
  from acme.adders import reverb
  from acme.utils import tree_utils
  import dm_env
  import numpy
  import reverb
  import tensorflow
  import tree
  from absl.testing import absltest
label_desc: Use image node_id 3 for calling a global function with example usage: _numeric_to_spec(x) and returns: specs, specs