code: def numpy_fallback(func):
      """decorator for falling back to offical numpy for a specific function"""
  
      def get_device(device, new_device):
          if device is None:
              return new_device
          else:
              if new_device is None:
                  new_device = device
              assert (
                  device == new_device
              ), f"inconsistent device {str(device)} and {str(new_device)}"
              return device
  
      def _as_official_np_array(object):
          device = None
          if hasattr(object, "asnumpy"):
              return object.asnumpy(), object.device
          elif isinstance(object, (list, tuple)):
              tmp = []
              for arr in object:
                  new_arr, new_device = _as_official_np_array(arr)
                  device = get_device(device, new_device)
                  tmp.append(new_arr)
              return object.__class__(tmp), device
          elif isinstance(object, dict):
              tmp = {}
              for k, v in object.items():
                  new_v, new_device = _as_official_np_array(v)
                  device = get_device(device, new_device)
                  tmp[k] = new_v
              return tmp, device
          else:
              return object, None
  
      from .ndarray import from_numpy
      from .numpy import array
      from .device import current_device
  
      def _as_mx_np_array(object, device=current_device()):
          import numpy as _np
  
          if isinstance(object, _np.ndarray):
              try:
                  ret = from_numpy(object).as_np_ndarray()
              except ValueError:
                  ret = array(object, dtype=object.dtype, device=device)
              return (
                  ret
                  if ("cpu" in str(device))
                  else ret.to_device(device)
              )
          elif isinstance(object, (list, tuple)):
              tmp = [_as_mx_np_array(arr, device) for arr in object]
              return object.__class__(tmp)
          elif isinstance(object, dict):
              return {k: _as_mx_np_array(v, device) for k, v in object}
          else:
              return object
  
      import re
  
      func_name = func.__name__
      func_doc = func.__doc__
      func_source = inspect.getsource(func)
      func_source = re.sub(r"np\.", "onp.", func_source)
      func_source = func_source.split("\n")[1:]
      indentation = func_source[0].find("def")
      if indentation == -1:
          raise ValueError("should wrap a function")
      stripped = []
      for line in func_source:
          stripped.append(line[indentation:])
      stripped.insert(1, "    import numpy as onp")
      func_source = "\n".join(stripped)
      local = {}
      exec(func_source, None, local)
      func = local[func_name]
      func.__doc__ = func_doc
  
      @functools.wraps(func)
      def _fallback_to_official_np(*args, **kwargs):
          # for every ndarray input, fallback
          new_args, device0 = _as_official_np_array(args)
          new_kwargs, device1 = _as_official_np_array(kwargs)
          device = get_device(device0, device1)
          ret = func(*new_args, **new_kwargs)
          if ret is None:
              raise ValueError(
                  "Only functions with return values are allowed to use this decorator"
              )
          ret = _as_mx_np_array(ret, device=device)
          return ret
  
      return _fallback_to_official_np
  
imports: import ctypes
  import functools
  import inspect
  import threading
  import tempfile
  import platform
  from contextlib import contextmanager
  from struct import calcsize
  from .base import _LIB, check_call, c_str, py_str, numeric_types, integer_types, long, _MAX_VALUE_64_BIT_UNSIGNED_, _MAX_VALUE_64_BIT_SIGNED_, _MAX_VALUE_FLOAT32_REPRESENT_
label_desc: Use image node_id 20 for calling a global function with example usage: numpy_fallback(func) and returns: _fallback_to_official_np, ret, new_device, device, object,  object, unknown, object,  device, object, tmp,  device, object,  None, unknown, object