code: def device_of_devicendarray(devicendarray):
      """
      Returns the device that backs memory allocated on the given
      deviceNDArray
      :param devicendarray: devicendarray array to check
      :return: int device id
      """
      dev = device_of_gpu_matrix(devicendarray)
      return get_visible_devices()[dev]
  
imports: from threading import Lock
  from asyncio import InvalidStateError
  from cuml.internals.import_utils import check_min_dask_version
  from cuml.common import device_of_gpu_matrix
  from dask.distributed import default_client, wait
  import time
  import random
  import dask
  import logging
  import os
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 2 for calling a global function with example usage: device_of_devicendarray(devicendarray) and returns: get_visible_devices