code: def _from_uniform(dim: Hyperparameter) -> Integer | Real:
      """Builds a uniform dimension from a uniform hyperparameter"""
  
      klass = Integer
      args = []
      kwargs = dict(
          # NOTE: Config space always has a config value
          # so orion-space would get it as well
          default_value=dim.default_value
      )
  
      if isinstance(dim, UniformFloatHyperparameter):
          klass = Real
      else:
          kwargs["precision"] = int(-log10(dim.q)) if dim.q else 4
  
      if dim.log:
          dist = "reciprocal"
          args.append(dim.lower)
          args.append(dim.upper)
      else:
          # NB: scipy uniform [loc, scale], configspace [min, max] with max = loc + scale, loc = min
          loc = dim.lower
          scale = dim.upper - dim.lower
  
          dist = "uniform"
          args.append(loc)
          args.append(scale)
  
      return klass(dim.name, dist, *args, **kwargs)
  
imports: from __future__ import annotations
  from copy import deepcopy
  from functools import singledispatch
  from math import log10
  from orion.algo.space import Categorical, Dimension, Fidelity, Integer, Real, Space, SpaceConverter, to_orionspace
label_desc: Use image node_id 7 for calling a global function with example usage: _from_uniform(dim) and returns: klass