code: def create_variable(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'])
docs: Creates a variable from a dictionary descriptor