# Path: google/cloud/ndb/exceptions.py
# class Error(Exception):
# class ContextError(Error):
# class BadValueError(Error):
# class BadArgumentError(Error):
# class BadRequestError(Error):
# class Rollback(Error):
# class BadQueryError(Error):
# class BadFilterError(Error):
# class NoLongerImplementedError(NotImplementedError):
# class Cancelled(Error):
# class NestedRetryException(Error):
#     def __init__(self):
#     def __init__(self, filter):
#     def __init__(self):
# 
# Path: google/cloud/ndb/_options.py
# class Options(object):
# class ReadOptions(Options):
#     def options_or_model_properties(cls, wrapped):
#     def options(cls, wrapped, _disambiguate_from_model_properties=False):
#         def wrapper(*args, **kwargs):
#                 def get_arg(kwargs, name):
#     def slots(cls):
#     def __init__(self, config=None, **kwargs):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __repr__(self):
#     def copy(self, **kwargs):
#     def items(self):
#     def __init__(self, config=None, **kwargs):
# 
# Path: google/cloud/ndb/tasklets.py
# class Future(object):
# class _TaskletFuture(Future):
# class _MultiFuture(Future):
# class Return(Exception):
# class QueueFuture(object):
# class ReducingFuture(object):
# class SerialQueueFuture(object):
#     def __init__(self, info="Unknown"):
#     def __repr__(self):
#     def done(self):
#     def running(self):
#     def wait(self):
#     def check_success(self):
#     def set_result(self, result):
#     def set_exception(self, exception):
#     def _finish(self):
#     def result(self):
#     def exception(self):
#     def get_traceback(self):
#     def add_done_callback(self, callback):
#     def cancel(self):
#     def cancelled(self):
#     def wait_any(futures):
#     def wait_all(futures):
#     def __init__(self, generator, context, info="Unknown"):
#     def _advance_tasklet(self, send_value=None, error=None):
#         def done_callback(yielded):
#     def cancel(self):
# def _get_return_value(stop):
#     def __init__(self, dependencies):
#     def __repr__(self):
#     def _dependency_done(self, dependency):
#     def cancel(self):
# def tasklet(wrapped):
#     def tasklet_wrapper(*args, **kwargs):
# def wait_any(futures):
# def wait_all(futures):
# def sleep(seconds):
# def add_flow_exception(*args, **kwargs):
# def make_context(*args, **kwargs):
# def make_default_context(*args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
# def set_context(*args, **kwargs):
# def synctasklet(wrapped):
#     def synctasklet_wrapper(*args, **kwargs):
# def toplevel(wrapped):
#     def toplevel_wrapper(*args, **kwargs):
# 
# Path: google/cloud/ndb/utils.py
# TRUTHY_STRINGS = {"t", "true", "y", "yes", "on", "1"}
# DEBUG = asbool(os.environ.get("NDB_DEBUG", False))
# def asbool(value):
# def code_info(*args, **kwargs):
# def decorator(*args, **kwargs):
# def frame_info(*args, **kwargs):
# def func_info(*args, **kwargs):
# def gen_info(*args, **kwargs):
# def get_stack(*args, **kwargs):
# def logging_debug(log, message, *args, **kwargs):
#     def __init__(self, **kwargs):
#     def __call__(self, wrapped):
#         def wrapper(*args, **kwargs):
# def positional(max_pos_args):
#     def positional_decorator(wrapped):
#         def positional_wrapper(*args, **kwds):
# def tweak_logging(*args, **kwargs):
# def wrapping(*args, **kwargs):
# class keyword_only(object):


import base64
import functools
import six
import google.cloud.datastore
from google.cloud.datastore import _app_engine_key_pb2
from google.cloud.datastore import key as _key_module
from google.cloud.ndb import exceptions
from google.cloud.ndb import _options
from google.cloud.ndb import tasklets
from google.cloud.ndb import utils
        from google.cloud.ndb import model
        from google.cloud.ndb import context as context_module
        from google.cloud.ndb import _datastore_api
        from google.cloud.ndb import _transaction
        from google.cloud.ndb import model
        from google.cloud.ndb import context as context_module
        from google.cloud.ndb import _datastore_api
    from google.cloud.ndb import context as context_module
    from google.cloud.ndb import context as context_module
                up to ``retries`` + 1 times. Set to ``0`` to try operation only
                once, with no retries.
            timeout (float): Override the gRPC timeout, in seconds.
            deadline (float): DEPRECATED: Synonym for ``timeout``.
            use_cache (bool): Specifies whether to store entities in in-process
                cache; overrides in-process cache policy for this operation.
            use_global_cache (bool): Specifies whether to store entities in
                global cache; overrides global cache policy for this operation.
            use_datastore (bool): Specifies whether to store entities in
                Datastore; overrides Datastore policy for this operation.
            global_cache_timeout (int): Maximum lifetime for entities in global
                cache; overrides global cache timeout policy for this
                operation.
            use_memcache (bool): DEPRECATED: Synonym for ``use_global_cache``.
            memcache_timeout (int): DEPRECATED: Synonym for
                ``global_cache_timeout``.
            max_memcache_items (int): No longer supported.
            read_policy: DEPRECATED: Synonym for ``read_consistency``.
            force_writes (bool): No longer supported.

        Returns:
            :class:`~google.cloud.ndb.tasklets.Future`
        """
        # Avoid circular import in Python 2.7

        cls = model.Model._kind_map.get(self.kind())

        if cls:
            cls._pre_get_hook(self)


# Path: google/cloud/ndb/exceptions.py
# class Error(Exception):
# class ContextError(Error):
# class BadValueError(Error):
# class BadArgumentError(Error):
# class BadRequestError(Error):
# class Rollback(Error):
# class BadQueryError(Error):
# class BadFilterError(Error):
# class NoLongerImplementedError(NotImplementedError):
# class Cancelled(Error):
# class NestedRetryException(Error):
#     def __init__(self):
#     def __init__(self, filter):
#     def __init__(self):
# 
# Path: google/cloud/ndb/_options.py
# class Options(object):
# class ReadOptions(Options):
#     def options_or_model_properties(cls, wrapped):
#     def options(cls, wrapped, _disambiguate_from_model_properties=False):
#         def wrapper(*args, **kwargs):
#                 def get_arg(kwargs, name):
#     def slots(cls):
#     def __init__(self, config=None, **kwargs):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __repr__(self):
#     def copy(self, **kwargs):
#     def items(self):
#     def __init__(self, config=None, **kwargs):
# 
# Path: google/cloud/ndb/tasklets.py
# class Future(object):
# class _TaskletFuture(Future):
# class _MultiFuture(Future):
# class Return(Exception):
# class QueueFuture(object):
# class ReducingFuture(object):
# class SerialQueueFuture(object):
#     def __init__(self, info="Unknown"):
#     def __repr__(self):
#     def done(self):
#     def running(self):
#     def wait(self):
#     def check_success(self):
#     def set_result(self, result):
#     def set_exception(self, exception):
#     def _finish(self):
#     def result(self):
#     def exception(self):
#     def get_traceback(self):
#     def add_done_callback(self, callback):
#     def cancel(self):
#     def cancelled(self):
#     def wait_any(futures):
#     def wait_all(futures):
#     def __init__(self, generator, context, info="Unknown"):
#     def _advance_tasklet(self, send_value=None, error=None):
#         def done_callback(yielded):
#     def cancel(self):
# def _get_return_value(stop):
#     def __init__(self, dependencies):
#     def __repr__(self):
#     def _dependency_done(self, dependency):
#     def cancel(self):
# def tasklet(wrapped):
#     def tasklet_wrapper(*args, **kwargs):
# def wait_any(futures):
# def wait_all(futures):
# def sleep(seconds):
# def add_flow_exception(*args, **kwargs):
# def make_context(*args, **kwargs):
# def make_default_context(*args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
# def set_context(*args, **kwargs):
# def synctasklet(wrapped):
#     def synctasklet_wrapper(*args, **kwargs):
# def toplevel(wrapped):
#     def toplevel_wrapper(*args, **kwargs):
# 
# Path: google/cloud/ndb/utils.py
# TRUTHY_STRINGS = {"t", "true", "y", "yes", "on", "1"}
# DEBUG = asbool(os.environ.get("NDB_DEBUG", False))
# def asbool(value):
# def code_info(*args, **kwargs):
# def decorator(*args, **kwargs):
# def frame_info(*args, **kwargs):
# def func_info(*args, **kwargs):
# def gen_info(*args, **kwargs):
# def get_stack(*args, **kwargs):
# def logging_debug(log, message, *args, **kwargs):
#     def __init__(self, **kwargs):
#     def __call__(self, wrapped):
#         def wrapper(*args, **kwargs):
# def positional(max_pos_args):
#     def positional_decorator(wrapped):
#         def positional_wrapper(*args, **kwds):
# def tweak_logging(*args, **kwargs):
# def wrapping(*args, **kwargs):
# class keyword_only(object):


# Path: google/cloud/ndb/key.py
import base64
import functools
import six
import google.cloud.datastore
from google.cloud.datastore import _app_engine_key_pb2
from google.cloud.datastore import key as _key_module
from google.cloud.ndb import exceptions
from google.cloud.ndb import _options
from google.cloud.ndb import tasklets
from google.cloud.ndb import utils
        from google.cloud.ndb import model
        from google.cloud.ndb import context as context_module
        from google.cloud.ndb import _datastore_api
        from google.cloud.ndb import _transaction
        from google.cloud.ndb import model
        from google.cloud.ndb import context as context_module
        from google.cloud.ndb import _datastore_api
    from google.cloud.ndb import context as context_module
    from google.cloud.ndb import context as context_module

                up to ``retries`` + 1 times. Set to ``0`` to try operation only
                once, with no retries.
            timeout (float): Override the gRPC timeout, in seconds.
            deadline (float): DEPRECATED: Synonym for ``timeout``.
            use_cache (bool): Specifies whether to store entities in in-process
                cache; overrides in-process cache policy for this operation.
            use_global_cache (bool): Specifies whether to store entities in
                global cache; overrides global cache policy for this operation.
            use_datastore (bool): Specifies whether to store entities in
                Datastore; overrides Datastore policy for this operation.
            global_cache_timeout (int): Maximum lifetime for entities in global
                cache; overrides global cache timeout policy for this
                operation.
            use_memcache (bool): DEPRECATED: Synonym for ``use_global_cache``.
            memcache_timeout (int): DEPRECATED: Synonym for
                ``global_cache_timeout``.
            max_memcache_items (int): No longer supported.
            read_policy: DEPRECATED: Synonym for ``read_consistency``.
            force_writes (bool): No longer supported.

        Returns:
            :class:`~google.cloud.ndb.tasklets.Future`
        """
        # Avoid circular import in Python 2.7

        cls = model.Model._kind_map.get(self.kind())

        if cls:
            cls._pre_get_hook(self)


        @tasklets.tasklet