code: def wrap_ctx_to_device_func(func):
      """A convenience decorator for converting ctx to device keyward backward compatibility
  
      Parameters
      ----------
      func : a function to be wrapped for context keyward change.
  
      Returns
      -------
      Function
          A function wrapped with context keyward changes.
      """
  
      @functools.wraps(func)
      def _wrap_func_with_ctx(*args, **kwargs):
          if len(kwargs) != 0:
              device = kwargs.pop("ctx", None)
              if device is not None:
                  kwargs["device"] = device
          return func(*args, **kwargs)
  
      return _wrap_func_with_ctx
  
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 19 for calling a global function with example usage: wrap_ctx_to_device_func(func) and returns: _wrap_func_with_ctx, func