code: def _context_callbacks(app, key, original_context=_CONTEXT_MISSING):
          
          def _get_context(dummy_app):
              """Set the context proxy so that it points to a specific context.
              """
              _CONTEXT_LOCALS.context = _CONTEXT_LOCALS(key)  # pylint: disable=assigning-non-slot
  
          def _clear_context(dummy_app):
              """Remove the context proxy that points to a specific context and
              restore the original context, if there was one.
              """
              try:
                  del _CONTEXT_LOCALS.context
              except AttributeError:
                  pass
  
              if original_context is not _CONTEXT_MISSING:
                  setattr(_CONTEXT_LOCALS, key, original_context)
  
          # store for later so Blinker doesn't remove these listeners and so we
          # don't add them twice
          _CONTEXT_CALLBACK_MAP[app] = (_get_context, _clear_context)
  
          # and listen for any app context changes
          appcontext_pushed.connect(_get_context, app)
          appcontext_popped.connect(_clear_context, app)
  
          return (_get_context, _clear_context)
docs: Register the callbacks we need to properly pop and push the
          app-local context for a component.
  
          Args:
              app (flask.Flask): The app who this context belongs to. This is the
                  only sender our Blinker signal will listen to.
              key (str): The key on ``_CONTEXT_LOCALS`` that this app's context
                  listens to.
  
          Kwargs:
              original_context (dict): The original context present whenever
                  these callbacks were registered. We will restore the context to
                  this value whenever the app context gets popped.
  
          Returns:
              (function, function): A two-element tuple of the dynamic functions
                  we generated as appcontext callbacks. The first element is the
                  callback for ``appcontext_pushed`` (i.e., get and store the
                  current context) and the second element is the callback for
                  ``appcontext_popped`` (i.e., restore the current context to
                  to it's original value).