def toplevel(func):
synctaskletfunc = synctasklet(func)  <EOL>@utils.wrapping(func)<EOL>def add_context_wrapper(*args, **kwds):<EOL><INDENT>__ndb_debug__ = utils.func_info(func)<EOL>_state.clear_all_pending()<EOL>ctx = make_default_context()<EOL>try:<EOL><INDENT>set_context(ctx)<EOL>return synctaskletfunc(*args, **kwds)<EOL><DEDENT>finally:<EOL><INDENT>set_context(None)<EOL>ctx.flush().check_success()<EOL>eventloop.run()  <EOL><DEDENT><DEDENT>return add_context_wrapper<EOL>
A sync tasklet that sets a fresh default Context.

    Use this for toplevel view functions such as
    webapp.RequestHandler.get() or Django view functions.