dimensions = [(list(range(dim)) + [colon]) for dim in a.shape]
for dim in itertools.product(*dimensions):
    if dim.count(colon) == 1:
        pass
Iteration through all 1 dimensional subarrays of a multi-dimensional array