code: def cupy_wrapper(func):
      
  
      @functools.wraps(func)
      def wrapped(*args, **kwargs):
          args = list(args)
          for n, a in enumerate(args):
              if isinstance(a, np.ndarray):
                  args[n] = cp.asarray(a)
          for k, v in kwargs.items():
              if isinstance(v, np.ndarray):
                  kwargs[k] = cp.asarray(v)
          rtn = func(*args, **kwargs)
          if isinstance(rtn, (list, tuple)):
              for n, a in enumerate(rtn):
                  if isinstance(a, cp.core.core.ndarray):
                      rtn[n] = cp.asnumpy(a)
          else:
              if isinstance(rtn, cp.core.core.ndarray):
                  rtn = cp.asnumpy(rtn)
          return rtn
      return wrapped
docs: A wrapper function that converts numpy ndarray arguments to cupy
      arrays, and convert any cupy arrays returned by the wrapped
      function into numpy ndarrays.