

def _validate(self, value):
    if isinstance(value, dict):
        return self._modelclass(**value)
    if (not isinstance(value, self._modelclass)):
        raise datastore_errors.BadValueError(('Expected %s instance, got %r' % (self._modelclass.__name__, value)))

dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/model.py LocalStructuredProperty._validate/original