Add Python3 compatibility

Add Python3 compatibility while retaining Python2.6+ compatibility.

This PR uses the "six" library to handle Python3 changes involving xrange(), reduce(), and iteritems(). I can replace this with a custom compatibility module if external dependencies aren't desired.