code: def _ureduce(a, func, **kwargs):
      """
      Internal Function.
      Call `func` with `a` as first argument swapping the axes to use extended
      axis on functions that don't support it natively.
  
      Returns result and a.shape with axis dims set to 1.
  
      Parameters
      ----------
      a : array_like
          Input tensor or object that can be converted to a tensor.
      func : callable
          Reduction function capable of receiving a single axis argument.
          It is called with `a` as first argument followed by `kwargs`.
      kwargs : keyword arguments
          additional keyword arguments to pass to `func`.
  
      Returns
      -------
      result : tuple
          Result of func(a, **kwargs) and a.shape with axis dims set to 1
          which can be used to reshape the result to the same shape a ufunc with
          keepdims=True would produce.
  
      """
      axis = kwargs.get("axis", None)
      if axis is not None:
          keepdim = list(a.shape)
          nd = a.ndim
          axis = normalize_axis_tuple(axis, nd)
  
          for ax in axis:
              keepdim[ax] = 1
  
          if len(axis) == 1:
              kwargs["axis"] = axis[0]
          else:
              keep = set(range(nd)) - set(axis)
              nkeep = len(keep)
              # swap axis that should not be reduced to front
              for i, s in enumerate(sorted(keep)):
                  a = a.swapaxes(i, s)
              # merge reduced axis
              a = a.reshape(a.shape[:nkeep] + (-1,))
              kwargs["axis"] = -1
          keepdim = tuple(keepdim)
      else:
          keepdim = (1,) * a.ndim
  
      r = func(a, **kwargs)
      return r, keepdim
  
label_desc: Use image node_id 1 for calling a global function with example usage: _ureduce(a, func) and returns: r,  keepdim