def _validate_other(self, value, state):
        if self.max is None and self.min is None:
            return
        if value is None:
            value = ''
        elif not isinstance(value, six.string_types):
            try:
                value = str(value)
            except UnicodeEncodeError:
                value = six.text_type(value)
        if self.max is not None and len(value) > self.max:
            raise Invalid(
                self.message('tooLong', state, max=self.max), value, state)
        if self.min is not None and len(value) < self.min:
            raise Invalid(
                self.message('tooShort', state, min=self.min), value, state)
dataset/ETHPy150Open formencode/formencode/formencode/validators.py/ByteString._validate_other/original