human
Complete this python program:
def keepdims_wrapper(a_callable):
assistant
#Here is the Python code you requested.

    """A wrapper for functions that don\t provide keepdims to ensure that they do.
    """
    if ('keepdims' in getargspec(a_callable).args):
        return a_callable
    @wraps(a_callable)
    def keepdims_wrapped_callable(x, axis=None, keepdims=None, *args, **kwargs):
        r = a_callable(x, axis=axis, *args, **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