code: def normalize_chunk_sizes(shape, chunk_size):
      shape = normalize_shape(shape)
      if not isinstance(chunk_size, tuple):
          if isinstance(chunk_size, Iterable):
              chunk_size = tuple(chunk_size)
          elif isinstance(chunk_size, int):
              chunk_size = (chunk_size,) * len(shape)
  
      if len(shape) != len(chunk_size):
          raise ValueError(
              "Chunks must have the same dimemsion, "
              f"got shape: {shape}, chunks: {chunk_size}"
          )
  
      chunk_sizes = []
      for size, chunk in zip(shape, chunk_size):
          if isinstance(chunk, Iterable):
              if not isinstance(chunk, tuple):
                  chunk = tuple(chunk)
  
              # if chunk is (np.nan,), it means we need to concat
              # all chunks together.
              if chunk == (np.nan,):
                  chunk = (size,)
  
              if sum(chunk) != size:
                  raise ValueError(
                      "chunks shape should be of the same length, "
                      f"got shape: {size}, chunks: {chunk}"
                  )
              chunk_sizes.append(chunk)
          else:
              assert isinstance(chunk, int)
  
              if size == 0:
                  sizes = (0,)
              else:
                  sizes = tuple(
                      chunk for _ in range(int(size / chunk))
                  ) + (
                      tuple() if size % chunk == 0 else (size % chunk,)
                  )
              chunk_sizes.append(sizes)
  
      return tuple(chunk_sizes)
  
imports: import inspect
  import itertools
  import operator
  from collections import OrderedDict
  from collections.abc import Iterable
  from functools import lru_cache, reduce, wraps
  from math import ceil
  from numbers import Integral
  from typing import Dict, List, Union
  import numpy
  from ..core import ExecutableTuple, recursive_tile
  from ..utils import lazy_import
  from ..lib.mmh3 import hash_from_buffer
label_desc: Use image node_id 2 for calling a global function with example usage: normalize_chunk_sizes(shape, chunk_size) and returns: tuple