<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_dimension(model, input_dimension):
 """ Given a model that takes an array of dimension input_dimension, returns the output dimension. """

    if not(_HAS_SKLEARN):
        raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disabled.')

    _sklearn_util.check_fitted(model, lambda m: hasattr(m, 'active_features_'))
    _sklearn_util.check_fitted(model, lambda m: hasattr(m, 'n_values_'))

    if model.categorical_features == 'all':
        return len(model.active_features_)
    else:
        out_dimension = (len(model.active_features_)
                         + (input_dimension - len(model.n_values_)))

    return out_dimension