def _validate(self, value: Any, typecast: bool, context: dict[(str, Any)]={}) -> tuple[(Optional[N], list[Error])]:
    (value, type_errors) = self._validate_exact_type(value)
    if type_errors:
        return (None, type_errors)
    errors = []
    if ((self._allowed is not None) and (value not in self._allowed)):
        errors.append(self._error('not_allowed', {'allowed': self._allowed}))
    if ((self._less_than is not None) and (value >= self._less_than)):
        errors.append(self._error('greater_or_equal_to', {'value': self._less_than}))
    if ((self._less_or_equal_to is not None) and (value > self._less_or_equal_to)):
        errors.append(self._error('greater_than', {'value': self._less_or_equal_to}))
    if ((self._greater_than is not None) and (value <= self._greater_than)):
        errors.append(self._error('less_or_equal_to', {'value': self._greater_than}))
    if ((self._greater_or_equal_to is not None) and (value < self._greater_or_equal_to)):
        errors.append(self._error('less_than', {'value': self._greater_or_equal_to}))
    (value, rule_errors) = self._call_rules(value, typecast, context)
    return (value, (errors + rule_errors))
def _validate(self, value: Any, typecast: bool, context: dict[(str, Any)]={}) -> tuple[(Optional[N], list[Error])]:
    (value, type_errors) = self._validate_exact_type(value)
    if type_errors:
        return (None, type_errors)
    errors = []
    if ((self._allowed is not None) and (value not in self._allowed)):
        errors.append(self._error('not_allowed', {'allowed': self._allowed}))
    if ((self._less_than is not None) and (value >= self._less_than)):
        errors.append(self._error('greater_or_equal_to', {'value': self._less_than}))
    if ((self._less_or_equal_to is not None) and (value > self._less_or_equal_to)):
        errors.append(self._error('greater_than', {'value': self._less_or_equal_to}))
    if ((self._greater_than is not None) and (value <= self._greater_than)):
        errors.append(self._error('less_or_equal_to', {'value': self._greater_than}))
    if ((self._greater_or_equal_to is not None) and (value < self._greater_or_equal_to)):
        errors.append(self._error('less_than', {'value': self._greater_or_equal_to}))
    (value, rule_errors) = self._call_rules(value, typecast, context)
    return (value, (errors + rule_errors))