2to3 with various manual fixes (cg C functions wants ascii bytes, not strings; // instead of / where only integers were meant, ...)