This is some code I produced for a summer project in 2015.
I was generating Moodle quizzes to improve first year practical teaching at the University of Cambridge. The results are now published: https://doi.org/10.1080/23752696.2017.1338529
A problem we regularly came up against was how to change questions from one format to another, which was a laborious process. This is one of the scripts I wrote to switch question formats after downloading them as a Moodle XML file.