code: def with_cpu(cpu_id=0):
      """Try execute on gpu, if not fallback to cpu"""
  
      def test_helper(orig_test):
          @make_decorator(orig_test)
          def test_wrapper(*args, **kwargs):
              try:
                  a = mx.nd.zeros((1,), ctx=mx.cpu(cpu_id))
                  ctx = mx.cpu(cpu_id)
              except Exception:
                  ctx = mx.cpu(0)
              with ctx:
                  orig_test(*args, **kwargs)
  
          return test_wrapper
  
      return test_helper
  
file_path: gluon-cv/tests/unittests/common.py
imports: import sys, os, logging
  import mxnet
  import numpy
  import random
  import shutil
  from contextlib import contextmanager
  from nose.tools import make_decorator
  import tempfile
label_desc: Use image node_id 2 for calling a global function with example usage: with_cpu(cpu_id) and returns: test_helper, test_wrapper