

def _validate(self, value):
    if (not isinstance(value, Key)):
        raise datastore_errors.BadValueError(('Expected Key, got %r' % (value,)))
    if (not value.id()):
        raise datastore_errors.BadValueError(('Expected complete Key, got %r' % (self,)))
    if (self._kind is not None):
        if (value.kind() != self._kind):
            raise datastore_errors.BadValueError(('Expected Key with kind=%r, got %r' % (self._kind, value)))

dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/model.py KeyProperty._validate/VarMisuse@62/94 `value`->`self`