How do I map class specific dataset?

Let say, I have a mnist dataset with two classes (0 and 1). I want to create a dictionary which looks like dic= { ‘0’: all the zero sample images, ‘1’: all the one sample images}.

@ptrblck please look into this problem.