code: def iterate_over_chunks(chunks, cdata_shape, slice_tuple=()):
      """
      Iterate over chunks of a given shape.
  
      Args:
          chunks: the chunk shape
          cdata_shape: the shape of the data in chunks
          slice_tuple: the slice tuple to be used for indexing
  
      Raises:
          ValueError: When the length of chunks and cdata_shape are not the same.
  
      Yields:
          slices of the data
      """
      if len(chunks) != len(cdata_shape):
          raise ValueError(
              "chunks and cdata_shape must have the same length"
          )
      if len(chunks) == 1:
          for i in range(cdata_shape[0]):
              yield slice_tuple + (
                  slice(i * chunks[0], (i + 1) * chunks[0]),
              )
      else:
          for i in range(cdata_shape[0]):
              yield from iterate_over_chunks(
                  chunks[1:],
                  cdata_shape[1:],
                  slice_tuple
                  + (slice(i * chunks[0], (i + 1) * chunks[0]),),
              )
  
imports: from __future__ import annotations
  import threading
  from abc import ABC, abstractmethod
  from collections.abc import Sequence
  from contextlib import nullcontext
  from typing import TYPE_CHECKING, Any
  import numpy
  import torch
  from monai.utils import ensure_tuple_size, optional_import, require_pkg
label_desc: Use image node_id 1 for calling a global function with example usage: iterate_over_chunks(chunks, cdata_shape, slice_tuple) without return types