code: def save_device(device: TorchDeviceType):
      """
  
      Parameters
      ----------
      device
          Torch device to be serialised. Can be specified by passing either ``'cuda'``,
          ``'gpu'``, ``'cpu'`` or an instance of ``torch.device``.
  
      Returns
      -------
      a string with value ``'cuda'`` or ``'cpu'``.
      """
      device_str = str(device)
      return device_str.split(":")[0]
  
file_path: alibi-detect/alibi_detect/saving/_pytorch/saving.py
imports: import os
  import logging
  from pathlib import Path
  from typing import Any, Callable, Dict, Optional, Tuple, Union
  import dill
  import torch
  import torch.nn
  from alibi_detect.cd.pytorch import UAE, HiddenOutput
  from alibi_detect.models.pytorch import TransformerEmbedding
  from alibi_detect.utils.frameworks import Framework
  from alibi_detect.utils._types import TorchDeviceType
label_desc: Use image node_id 4 for calling a global function with example usage: save_device(device) and returns: device_str