code: def find_device(data):
      """
      Finds the device on which a nested dict/list/tuple of tensors lies (assuming they are all on the same device).
  
      Args:
          (nested list/tuple/dictionary of `torch.Tensor`): The data we want to know the device of.
      """
      if isinstance(data, Mapping):
          for obj in data.values():
              device = find_device(obj)
              if device is not None:
                  return device
      elif isinstance(data, (tuple, list)):
          for obj in data:
              device = find_device(obj)
              if device is not None:
                  return device
      elif isinstance(data, torch.Tensor):
          return data.device
  
imports: import pickle
  import warnings
  from functools import update_wrapper, wraps
  from typing import Any, Mapping
  import torch
  from ..state import PartialState
  from .constants import TORCH_DISTRIBUTED_OPERATION_TYPES
  from .dataclasses import DistributedType, TensorInformation
  from .imports import is_npu_available, is_torch_distributed_available, is_torch_version, is_tpu_available
label_desc: Use image node_id 30 for calling a global function with example usage: find_device(data) and returns: device, data, device