Rework Python 3.x support to use six.