code: def with_environment(*args_):
      """
      Helper function that takes a dictionary of environment variables and their
      desired settings and changes the environment in advance of running the
      decorated code.  The original environment state is reinstated afterwards,
      even if exceptions are raised.
      """
  
      def test_helper(orig_test):
          @functools.wraps(orig_test)
          def test_new(*args, **kwargs):
              with environment(*args_):
                  orig_test(*args, **kwargs)
  
          return test_new
  
      return test_helper
  
imports: import sys, os, logging, functools
  import multiprocessing
  import mxnet
  import numpy
  import random
  import shutil
  from mxnet.base import MXNetError
  from mxnet.test_utils import environment
  import models
  from contextlib import contextmanager
  import pytest
  from mxnet.util import TemporaryDirectory
  import locale
label_desc: Use image node_id 7 for calling a global function with example usage: with_environment() and returns: test_helper, test_new