Converted single quotes to double quotes in db.py per Numente coding guidelines.
Instead of the unwelcome creation of the output XML file in /tmp, use the tempfile module to create a temp file safely and then delete it when the operation completes successfully.