def validate(self, value):
        """Validate value.

        :param value: Value which should be validated.

        :raises: :class:`halogen.exception.ValidationError` exception when either if value less than min in case when
        min is not None or if value greater than max in case when max is not None.
        """
        if self.min is not None:
            min_value = self.min() if callable(self.min) else self.min
            if value < min_value:
                raise exceptions.ValidationError(self.min_err.format(val=value, min=min_value))

        if self.max is not None:
            max_value = self.max() if callable(self.max) else self.max
            if value > max_value:
                raise exceptions.ValidationError(self.max_err.format(val=value, max=max_value))