def validate(self, value):
    value = super(DateTimeProperty, self).validate(value)
    if value and not isinstance(value, self.data_type):
      raise BadValueError('Property %s must be a %s, but was %r' %
                          (self.name, self.data_type.__name__, value))
    return value
Validate datetime.
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/__init__.py/DateTimeProperty.validate