code: def _call_func(impl, args, kw):
      # Note that `_pytest.outcomes.Skipped` is derived from BaseException.
      exceptions = (Exception,)
      if _is_pytest_available:
          exceptions += (_pytest.outcomes.Skipped,)
  
      try:
          result = impl(*args, **kw)
          error = None
      except exceptions as e:
          tb = e.__traceback__
          if tb.tb_next is None:
              # failed before impl is called, e.g. invalid kw
              raise e
          result = None
          error = e
  
      return result, error
  
imports: import functools
  import inspect
  import os
  import random
  from typing import Tuple, Type
  import traceback
  import unittest
  import warnings
  import numpy
  import cupy
  from cupy.testing import _array
  from cupy.testing import _parameterized
  import cupyx
  import cupyx.scipy.sparse
  from cupy.testing._pytest_impl import is_available
label_desc: Use image node_id 2 for calling a global function with example usage: _call_func(impl, args, kw) and returns: result,  error