code: def create_variable(descriptor):
      """
      Creates a variable from a dictionary descriptor
      """
      if descriptor["type"] == "continuous":
          return ContinuousVariable(
              descriptor["name"],
              descriptor["domain"],
              descriptor.get("dimensionality", 1),
          )
      elif descriptor["type"] == "bandit":
          return BanditVariable(
              descriptor["name"],
              descriptor["domain"],
              descriptor.get("dimensionality", None),
          )  # bandits variables cannot be repeated
      elif descriptor["type"] == "discrete":
          return DiscreteVariable(
              descriptor["name"],
              descriptor["domain"],
              descriptor.get("dimensionality", 1),
          )
      elif descriptor["type"] == "categorical":
          return CategoricalVariable(
              descriptor["name"],
              descriptor["domain"],
              descriptor.get("dimensionality", 1),
          )
      else:
          raise InvalidConfigError(
              "Unknown variable type " + descriptor["type"]
          )
  
imports: import numpy
  from copy import deepcopy
  from ..errors import InvalidConfigError
label_desc: Use image node_id 1 for calling a global function with example usage: create_variable(descriptor) and returns: ContinuousVariable, BanditVariable, DiscreteVariable, CategoricalVariable