code: def _split_partials_per_axis(
      x: da.Array, chunks: ChunkedAxes
  ) -> tuple[tuple[_Partial, ...], ...]:
      """Split the rechunking into partials that can be performed separately
      on each axis"""
      from dask.array.rechunk import old_to_new
  
      chunked_shape = tuple(len(axis) for axis in chunks)
      _old_to_new = old_to_new(x.chunks, chunks)
  
      sliced_axes = _partial_slices(_old_to_new, chunked_shape)
  
      partial_axes = []
      for axis_index, slices in enumerate(sliced_axes):
          partials = []
          for slice_ in slices:
              last_old_chunk: int
              first_old_chunk, first_old_slice = _old_to_new[
                  axis_index
              ][slice_.start][0]
              last_old_chunk, last_old_slice = _old_to_new[axis_index][
                  slice_.stop - 1
              ][-1]
              partials.append(
                  _Partial(
                      old=slice(first_old_chunk, last_old_chunk + 1),
                      new=slice_,
                      left_start=first_old_slice.start,
                      right_stop=last_old_slice.stop,
                  )
              )
          partial_axes.append(tuple(partials))
      return tuple(partial_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 5 for calling a global function with example usage: _split_partials_per_axis(x, chunks) and returns: tuple