Add Python 3 support while maintaining Python 2 support.

This commit adds Python 3 support to the extension (just a change to the dependencies and basestring->str). It doesn't affect Python 2 code at all, so the same code will work for both versions.