code: def keepdims_wrapper(a_callable):
      """
      A wrapper for functions that don't provide keepdims to ensure that they do.
      """
  
      @wraps(a_callable)
      def keepdims_wrapped_callable(
          x, axis=None, keepdims=None, *args, **kwargs
      ):
          r = a_callable(x, *args, axis=axis, **kwargs)
  
          if not keepdims:
              return r
  
          axes = axis
  
          if axes is None:
              axes = range(x.ndim)
  
          if not isinstance(axes, (Container, Iterable, Sequence)):
              axes = [axes]
  
          r_slice = tuple()
          for each_axis in range(x.ndim):
              if each_axis in axes:
                  r_slice += (None,)
              else:
                  r_slice += (slice(None),)
  
          r = r[r_slice]
  
          return r
  
      return keepdims_wrapped_callable
  
imports: from __future__ import annotations
  import contextlib
  from collections.abc import Container, Iterable, Sequence
  from functools import wraps
  from numbers import Integral
  import numpy
  from tlz import concat
  from dask.core import flatten
label_desc: Use image node_id 1 for calling a global function with example usage: keepdims_wrapper(a_callable) and returns: keepdims_wrapped_callable, r, r