code: def get_optimal_device_name():
      if torch.cuda.is_available():
          return get_cuda_device_string()
  
      if has_mps():
          return "mps"
  
      if has_xpu():
          return xpu_specific.get_xpu_device_string()
  
      return "cpu"
  
imports: import sys
  import contextlib
  from functools import lru_cache
  import torch
  from modules import errors, shared
label_desc: Use image node_id 4 for calling a global function with example usage: get_optimal_device_name() and returns: str, get_cuda_device_string, str, xpu_specific