code: def run_with_stack_context(context, func):
      """Run a coroutine ``func`` in the given `StackContext`.
  
      It is not safe to have a ``yield`` statement within a ``with StackContext``
      block, so it is difficult to use stack context with `.gen.coroutine`.
      This helper function runs the function in the correct context while
      keeping the ``yield`` and ``with`` statements syntactically separate.
  
      Example::
  
          @gen.coroutine
          def incorrect():
              with StackContext(ctx):
                  # ERROR: this will raise StackContextInconsistentError
                  yield other_coroutine()
  
          @gen.coroutine
          def correct():
              yield run_with_stack_context(StackContext(ctx), other_coroutine)
  
      .. versionadded:: 3.1
      """
      with context:
          return func()
  
imports: from __future__ import absolute_import, division, print_function, with_statement
  import sys
  import threading
  from .util import raise_exc_info
label_desc: Use image node_id 4 for calling a global function with example usage: run_with_stack_context(context, func) and returns: func