code: def getitem_on_chunk_to_records(nsplits_acc, output_chunk):
      """
      Turns a `__getitem__` on chunk to a list of index-value records.
  
      Parameters
      ----------
      nsplits_acc:
          Accumulate nsplits arrays of the output tensor chunks.
  
      Returns
      -------
          records: A list of `(index, value_index)`, where `index` is the in-chunk index, and
          `value_index` is the index in the final result block.
          chunk_value_shape: shape of result of this chunk.
          chunk_value_slice: index of result of this chunk in the whole result tensor.
      """
      input_indices, value_indices = indexing_to_chunk_indices(
          output_chunk
      )
  
      chunk_value_slice = tuple(
          slice(
              nsplits_acc[i][output_chunk.index[i]],
              nsplits_acc[i][output_chunk.index[i] + 1],
          )
          for i in range(len(output_chunk.index))
      )
  
      records = []
      for chunk_idx, value_idx in zip(
          itertools.product(*input_indices),
          itertools.product(*value_indices),
      ):
          index_in_chunk = np.ravel_multi_index(
              chunk_idx, output_chunk.op.inputs[0].shape
          )
          records.append((index_in_chunk, value_idx))
      return records, output_chunk.shape, chunk_value_slice
  
file_path: mars/mars/services/mutable/utils.py
imports: from datetime import datetime
  import itertools
  from numbers import Integral
  from typing import Optional
  import uuid
  import numpy
  from ...core import tile
label_desc: Use image node_id 5 for calling a global function with example usage: getitem_on_chunk_to_records(nsplits_acc, output_chunk) and returns: records,  output_chunk,  chunk_value_slice