code: def sliding_window_view(x, window_shape, axis=None):
      window_shape = (
          tuple(window_shape)
          if np.iterable(window_shape)
          else (window_shape,)
      )
  
      window_shape_array = np.array(window_shape)
      if np.any(window_shape_array <= 0):
          raise ValueError("`window_shape` must contain values > 0")
  
      if axis is None:
          axis = tuple(range(x.ndim))
          if len(window_shape) != len(axis):
              raise ValueError(
                  f"Since axis is `None`, must provide "
                  f"window_shape for all dimensions of `x`; "
                  f"got {len(window_shape)} window_shape elements "
                  f"and `x.ndim` is {x.ndim}."
              )
      else:
          axis = normalize_axis_tuple(
              axis, x.ndim, allow_duplicate=True
          )
          if len(window_shape) != len(axis):
              raise ValueError(
                  f"Must provide matching length window_shape and "
                  f"axis; got {len(window_shape)} window_shape "
                  f"elements and {len(axis)} axes elements."
              )
  
      depths = [0] * x.ndim
      for ax, window in zip(axis, window_shape):
          depths[ax] += window - 1
  
      # Ensure that each chunk is big enough to leave at least a size-1 chunk
      # after windowing (this is only really necessary for the last chunk).
      safe_chunks = tuple(
          ensure_minimum_chunksize(d + 1, c)
          for d, c in zip(depths, x.chunks)
      )
      x = x.rechunk(safe_chunks)
  
      # result.shape = x_shape_trimmed + window_shape,
      # where x_shape_trimmed is x.shape with every entry
      # reduced by one less than the corresponding window size.
      # trim chunks to match x_shape_trimmed
      newchunks = tuple(
          c[:-1] + (c[-1] - d,) for d, c in zip(depths, x.chunks)
      ) + tuple((window,) for window in window_shape)
  
      return map_overlap(
          np.lib.stride_tricks.sliding_window_view,
          x,
          depth=tuple(
              (0, d) for d in depths
          ),  # Overlap on +ve side only
          boundary="none",
          meta=x._meta,
          new_axis=range(x.ndim, x.ndim + len(axis)),
          chunks=newchunks,
          trim=False,
          align_arrays=False,
          window_shape=window_shape,
          axis=axis,
      )
  
imports: from __future__ import annotations
  import warnings
  from numbers import Integral, Number
  import numpy
  from tlz import concat, get, partial
  from tlz.curried import map
  from dask.array import chunk
  from dask.array.core import Array, concatenate, map_blocks, unify_chunks
  from dask.array.creation import empty_like, full_like
  from dask.array.numpy_compat import normalize_axis_tuple
  from dask.base import tokenize
  from dask.highlevelgraph import HighLevelGraph
  from dask.layers import ArrayOverlapLayer
  from dask.utils import derived_from
label_desc: Use image node_id 19 for calling a global function with example usage: sliding_window_view(x, window_shape, axis) and returns: map_overlap