code: def get_device(device: Any) -> Any:
      import torch
  
      if device is None:
          return torch.device(
              "cuda:0" if torch.cuda.is_available() else "cpu"
          )
      if isinstance(device, str):
          return torch.device(device)
      return device
  
file_path: foolbox/foolbox/models/pytorch.py
imports: from typing import Any, cast
  import warnings
  import eagerpy
  from ..types import BoundsInput, Preprocessing
  from .base import ModelWithPreprocessing
label_desc: Use image node_id 1 for calling a global function with example usage: get_device(device) and returns: device, torch, torch