How to change the fastai prediction format to MICCAI competition format?

In a nutshell, I use the following code to generate prediction dice scores for a test set (consists of 90 samples) and saved in a file called

preds, _ = learn.get_preds(ds_type=DatasetType.Test), '')

Now I want to change the file into a zip file by each sample. How can I do this?

This is a part of the MICCAI challenge, not Kaggle. I copy-pasted the rules just in case.

Predictions should be submitted as a zip ( ) archive of .nii.gz files named prediction_00210.nii.gz, ..., prediction_00299.nii.gz corresponding to the ordered list of 90 test cases. That is, you should generate each of these prediction files in a particular directory, and then from that directory, run the following command:

zip prediction_*.nii.gz