'Pops the app context.'

def pop(self, exc=_sentinel):

    try:
        self._refcnt -= 1
        if (self._refcnt <= 0):
            if (exc is _sentinel):
                exc = sys.exc_info()[1]
            self.app.do_teardown_appcontext(exc)
    finally:
        rv = _app_ctx_stack.pop()
    assert (rv is self), ('Popped    wrong    app    context.        (%r    instead    of    %r)' % (rv, self))
    appcontext_popped.send(self.app)
