<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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'])