code: def _from_categorical(dim: CategoricalHyperparameter) -> Categorical:
      """Builds a categorical dimension from a categorical hyperparameter"""
      choices = dict(zip(dim.choices, dim.probabilities))
      return Categorical(dim.name, choices)
  
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 6 for calling a global function with example usage: _from_categorical(dim) and returns: Categorical