Merge the rest of py3 branch. Also make it compatible with py2, for the
lulz (and because it might suit mods)
Authored by: klaussfreire 2013-03-29
Parent: [r13608]
Child: [r13610]