The following would be good:

image = np.squeeze(image)
if image.ndim > 1:
    raise ...