code: def validate(self, value):
          
  
          cast_callback = self.cast_callback if self.cast_callback else self.cast_type
  
          try:
              return value if isinstance(value, self.cast_type) else cast_callback(value)
  
          except Exception:
              raise NodeTypeError('Invalid value `{}` for {}.'.format(value, self.cast_type))
docs: Base validation method. Check if type is valid, or try brute casting.
  
          Args:
              value (object): A value for validation.
  
          Returns:
              Base_type instance.
  
          Raises:
              SchemaError, if validation or type casting fails.