code: def _partial_slices(
      old_to_new: list[list[list[tuple[int, slice]]]],
      chunked_shape: NDIndex,
  ) -> tuple[tuple[slice, ...], ...]:
      """Compute the slices of the new chunks that can be computed separately"""
      sliced_axes = []
  
      for axis_index, old_to_new_axis in enumerate(old_to_new):
          # Two consecutive output chunks A and B belong to the same partial rechunk
          # if B is fully included in the right-most input chunk of A, i.e.,
          # separating A and B would not allow us to cull more input tasks.
  
          # Index of the last input chunk of this partial rechunk
          last_old_chunk: int | None = None
          partial_splits = [0]
          recipe: list[tuple[int, slice]]
          for new_chunk_index, recipe in enumerate(old_to_new_axis):
              if len(recipe) == 0:
                  continue
              current_last_old_chunk, old_slice = recipe[-1]
              if last_old_chunk is None:
                  last_old_chunk = current_last_old_chunk
              elif last_old_chunk != current_last_old_chunk:
                  partial_splits.append(new_chunk_index)
                  last_old_chunk = current_last_old_chunk
          partial_splits.append(chunked_shape[axis_index])
          sliced_axes.append(
              tuple(
                  slice(a, b)
                  for a, b in toolz.sliding_window(2, partial_splits)
              )
          )
      return tuple(sliced_axes)
  
imports: from __future__ import annotations
  import mmap
  import os
  from collections import defaultdict
  from collections.abc import Callable, Generator, Hashable, Sequence
  from concurrent.futures import ThreadPoolExecutor
  from dataclasses import dataclass
  from itertools import product
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, NamedTuple
  import toolz
  from tornado.ioloop import IOLoop
  import dask
  from dask.base import tokenize
  from dask.highlevelgraph import HighLevelGraph, MaterializedLayer
  from dask.typing import Key
  from distributed.core import PooledRPCCall
  from distributed.metrics import context_meter
  from distributed.shuffle._core import NDIndex, ShuffleId, ShuffleRun, ShuffleSpec, get_worker_plugin, handle_transfer_errors, handle_unpack_errors
  from distributed.shuffle._limiter import ResourceLimiter
  from distributed.shuffle._pickle import unpickle_bytestream
  from distributed.shuffle._shuffle import barrier_key, shuffle_barrier
  from distributed.shuffle._worker_plugin import ShuffleWorkerPlugin
  from distributed.sizeof import sizeof
label_desc: Use image node_id 6 for calling a global function with example usage: _partial_slices(old_to_new, chunked_shape) and returns: tuple