

def _validate_key(value, entity=None):
    if (not isinstance(value, Key)):
        raise datastore_errors.BadValueError(('Expected Key, got %r' % value))
    if (entity and (entity.__class__ not in (Model, Expando))):
        if (entity.kind() != entity._get_kind()):
            raise KindError(('Expected Key kind to be %s; received %s' % (entity._get_kind(), value.kind())))
    return value

dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/model.py _validate_key/VarMisuse@62/82 `value`->`entity`