add Py3k compatibility, while preserving python 2.6+ compatibility

Does what it says. Works in python 3.3, but preserves functionality in python 2.6+ using the standard 2to3 monkey patches. I tested the CPI example from the `README.rst` in `python2.6`, `python2.7`, and `python3.3`, and it works in all of them.