I modified the script a bit so categories and tags would actually show up in the output file.
-----
-[[!format '''
+[[!format python '''
#!/usr/bin/env python
"""
(Hopefully I've escaped everything properly; if I missed something, check the source.)
-----
-[[!format '''
+[[!format python '''
#!/usr/bin/env python
"""