def METHOD_NAME(instance, attribute, value):
    if ((min_value is not None) and (value < min_value)) or \
            ((max_value is not None) and (value > max_value)):
        raise ValueError("{} must be in range [{}, {}]".format(attribute.name, min_value, max_value))