python3 compatibility

This is the only incompatibility within cgen that I've run into so far.