code: def validate(self, instance, value):
          
          if self.cast:
              value = bool(value)
          if not isinstance(value, BOOLEAN_TYPES):
              self.error(instance, value)
          return value
docs: Checks if value is a boolean