code: def cntk_device(device_id):
      """
      Converts the legacy device ID as it was used in CNTK 1 to a :class:`~cntk.device.DeviceDescriptor` instance.
  
      Args:
          device_id (int): device id, -1 for CPU, 0 or higher for GPU
  
      Returns:
          :class:`~cntk.device.DeviceDescriptor`
      """
      if device_id == -1:
          return cpu()
      else:
          return gpu(device_id)
  
file_path: CNTK/bindings/python/cntk/ops/tests/ops_test_utils.py
imports: import os
  import numpy
  import cntk
  from cntk.tests.test_utils import *
  from cntk.device import cpu, gpu
  from ...ops.functions import Function
  from cntk.internal import sanitize_dtype_cntk
  from cntk.internal.utils import eval
  from ..None import constant
label_desc: Use image node_id 1 for calling a global function with example usage: cntk_device(device_id) and returns: cpu, gpu