Run under Python 3

This will make the code I wrote in :
http://lists.wikimedia.org/pipermail/wikitech-l/2014-May/076373.html
actually work in modern versions of Python.