Add Python 3 compatibility

This includes some easy Python 3 pickings (might have missed some). Requires Python 2.6 minimum (I believe).