code: def InvokeWithModifiedEnv(extra_env, function, *args, **kwargs):
      """Runs the given function and arguments in a modified environment."""
      try:
          original_env = environ.copy()
          environ.update(extra_env)
          return function(*args, **kwargs)
      finally:
          environ.clear()
          environ.update(original_env)
  
imports: import os
  import re
  import sys
  from googletest.test import gtest_test_utils
label_desc: Use image node_id 5 for calling a global function with example usage: InvokeWithModifiedEnv(extra_env, function) and returns: function