code: def dictify_chunk_size(shape, chunk_size):
      """
      Given chunk_size which may be a tuple or dict, return a dict type all the same.
  
      :param shape: tensor's shape
      :param chunk_size: if dict provided, it's dimension id to chunk size;
                         if provided, it's the chunk size for each dimension.
      :return: dict form of chunk_size
      """
      if chunk_size is not None:
          if isinstance(chunk_size, Iterable):
              if not isinstance(chunk_size, dict):
                  chunk_size = {i: c for i, c in enumerate(chunk_size)}
          elif isinstance(chunk_size, int):
              chunk_size = {i: chunk_size for i in range(len(shape))}
          else:
              raise TypeError(
                  f"chunks must be iterable, got {type(chunk_size)}"
              )
  
      if chunk_size is None:
          chunk_size = dict()
  
      return chunk_size
  
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 23 for calling a global function with example usage: dictify_chunk_size(shape, chunk_size) and returns: chunk_size