code: def load_device(device_spec):
      from fate.arch.unify import device
      from fate.components.core.spec.device import CPUSpec, GPUSpec
  
      if isinstance(device_spec, CPUSpec):
          return device.CPU
  
      if isinstance(device_spec, GPUSpec):
          return device.CUDA
      raise ValueError(f"device `{device_spec}` not implemented yet")
  
label_desc: Use image node_id 1 for calling a global function with example usage: load_device(device_spec) and returns: device, device