Set up simultaneous python 2/3 compatibility.

This is similar to #103, but the code runs on py2.6+ and py3.3+, instead of just being converted to use py3.3.