code: def _(dim: Dimension):
      lower, upper = dim.interval()
      if dim.shape:
          # Temporary fix pending [#800]
          # ng.p.Array expects an array with a shape or a float
          # an array with an empty shape is not valid
          # so we cast it to a float
          if hasattr(lower, "shape") and lower.shape == ():
              lower = float(lower)
  
          if hasattr(upper, "shape") and upper.shape == ():
              upper = float(upper)
  
          return ng.p.Array(
              lower=lower, upper=upper, shape=_intshape(dim.shape)
          )
      else:
          return ng.p.Scalar(lower=lower, upper=upper)
  
imports: from __future__ import annotations
  import logging
  import pickle
  from typing import Callable, Iterable, Sequence, SupportsInt
  from orion.algo.base import BaseAlgorithm
  from orion.algo.space import Categorical, Dimension, Fidelity, Integer, Real, Space
  from orion.core.utils.format_trials import dict_to_trial
  from orion.core.utils.module_import import ImportOptional
  from orion.core.worker.trial import Trial
label_desc: Use image node_id 5 for calling a global function with example usage: _(dim) and returns: ng, ng