code: def get_dtype(data: Any) -> DtypeLike | torch.dtype:
      """Get the dtype of an image, or if there is a sequence, recursively call the method on the 0th element.
  
      This therefore assumes that in a `Sequence`, all types are the same.
      """
      if hasattr(data, "dtype"):
          return data.dtype  # type: ignore
      # need recursion
      if isinstance(data, Sequence):
          return get_dtype(data[0])
      # objects like float don't have dtype, so return their type
      return type(data)
  
imports: from __future__ import annotations
  import re
  from collections.abc import Sequence
  from typing import Any
  import numpy
  import torch
  import monai
  from monai.config.type_definitions import DtypeLike, NdarrayTensor
  from monai.utils import optional_import
label_desc: Use image node_id 6 for calling a global function with example usage: get_dtype(data) and returns: type, data, get_dtype