def _check_stack_axis(axis, dims, default='unnamed'):
    """ check or get new axis name when stacking array or datasets
    (just to have that in one place)
    """
    if axis is None:
        axis = default
        if axis in dims:
            i = 1
            while default + '_{}'.format(i) in dims:
                i += 1
            axis = default + '_{}'.format(i)
    if type(axis) is int:
        raise TypeError('axis must be a str (new axis name)')
    if axis in dims:
        raise ValueError(
            'please provide an axis name which does not                 already exist, or use `concatenate`'
            )
    return axis
