code: def dev_util(
      device: Union[ivy.Device, ivy.NativeDevice],
      /,
  ) -> float:
      """Get the current utilization (%) for a given device.
  
      Parameters
      ----------
      device
          The device string of the device to query utilization for.
  
      Returns
      -------
      ret
          The device utilization (%)
  
      Example
      -------
      >>> ivy.dev_util('cpu')
      13.4
      >>> ivy.dev_util('gpu:0')
      7.8
      >>> ivy.dev_util('cpu')
      93.4
      >>> ivy.dev_util('gpu:2')
      57.4
      >>> ivy.dev_util('cpu')
      84.2
      """
      if device == "cpu":
          return psutil.cpu_percent()
      elif "gpu" in device:
          handle = _get_nvml_gpu_handle(device)
          return pynvml.nvmlDeviceGetUtilizationRates(handle).gpu
      else:
          raise ivy.utils.exceptions.IvyException(
              'Invalid device string input, must be on the form "gpu:idx" or "cpu", but'
              f" found {device}"
          )
  
imports: import os
  import gc
  import abc
  import math
  import psutil
  import warnings
  import types
  from typing import Type, Optional, Tuple
  from typing import Union, Callable, Iterable, Any
  import ivy
  from ivy.func_wrapper import handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nestable, handle_array_like_without_promotion, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 16 for calling a global function with example usage: dev_util() and returns: psutil, pynvml