Convert sagews into sws

A colleague asked if it is possible to convert from sagews into sws, so that he can use the notebooks that his students create on Sage Cloud.

I have found a sage-cloud thread which mentions this quick script.

My motivations for writing this questions are:

PD: For the record, sws files are compressed tar files that you can decompress with tar jxf %F. They contain an html file with code and comments, a pickle file with some python objects, a data folder with the attachments, and a cells folder with the images contained in the output of the cells. On the other hand, sagews files are plain text files with no attachments.