code: def _choose_device(op_name, wrapper_name, inputs, device_param):
      """Returns device type and device_id based on inputs and device_param."""
  
      input_device = ""
  
      if len(inputs) > 0:
          if any(
              isinstance(input, _tensors.TensorListGPU)
              for input in inputs
          ):
              input_device = "gpu:0"
          else:
              input_device = "cpu"
  
      if device_param is None:
          # Select device type based on inputs.
          device_param = input_device if input_device else "cpu"
  
      sep_pos = device_param.find(":")
  
      # Separate device and device_id.
      if sep_pos != -1:
          device = device_param[:sep_pos]
          device_id = int(device_param[sep_pos + 1 :])
      else:
          device = device_param
          device_id = 0
  
      if device == "cpu" and input_device == "gpu":
          raise ValueError(
              "An operator with device='cpu' cannot accept GPU inputs."
          )
  
      if device != "cpu" and device != "gpu":
          raise ValueError(f"Incorrect device type '{device}'.")
  
      if input_device == "cpu" and device == "gpu":
          if op_name in _ops._mixed_ops:
              device = "mixed"
          else:
              raise ValueError(
                  f"Operator '{wrapper_name}' not registered for mixed."
              )
  
      return device, device_id
  
imports: import sys
  from nvidia.dali import backend
  from nvidia.dali import internal
  from nvidia.dali import ops
  from nvidia.dali import tensors
  from nvidia.dali import types
  from nvidia.dali.external_source import _prep_data_for_feed_input
label_desc: Use image node_id 37 for calling a global function with example usage: _choose_device(op_name, wrapper_name, inputs, device_param) and returns: device,  device_id