It can be done using a function view_as_blocks of skimage.util.shape.
view_as_blocks
skimage.util.shape