code: def support_usm_ndarray(freefunc=False):
      def decorator(func):
          def wrapper_impl(obj, *args, **kwargs):
              if _sklearnex_available:
                  usm_iface = _extract_usm_iface(*args, **kwargs)
                  data_queue, hostargs, hostkwargs = _get_host_inputs(
                      *args, **kwargs
                  )
                  hostkwargs["queue"] = data_queue
                  result = _run_on_device(
                      func, obj, *hostargs, **hostkwargs
                  )
                  if usm_iface is not None and hasattr(
                      result, "__array_interface__"
                  ):
                      result = _copy_to_usm(data_queue, result)
                      if (
                          dpnp_available
                          and len(args) > 0
                          and isinstance(args[0], dpnp.ndarray)
                      ):
                          result = dpnp.array(result, copy=False)
                  return result
              return _run_on_device(func, obj, *args, **kwargs)
  
          if freefunc:
  
              @wraps(func)
              def wrapper_free(*args, **kwargs):
                  return wrapper_impl(None, *args, **kwargs)
  
              return wrapper_free
  
          @wraps(func)
          def wrapper_with_self(self, *args, **kwargs):
              return wrapper_impl(self, *args, **kwargs)
  
          return wrapper_with_self
  
      return decorator
  
imports: from functools import wraps
label_desc: Use image node_id 4 for calling a global function with example usage: support_usm_ndarray(freefunc) and returns: decorator, wrapper_with_self, _run_on_device, wrapper_free, wrapper_impl, result, wrapper_impl