Python 3 compatibility

Here's an alternative Python 3 compatibility pull request; I did this work about a month ago but never got around to putting together a clean patch that will apply again upstream until today.

This one bundles six directly instead of adding it as a dependency; it's only one file with a BSD license and it's designed to be easy to incorporate like this.

Tests pass on 2.7 and 3.3-3.5 inclusive.