Python 3 support

Please consider these changes, which collectively add Python 3 support.  The bulk of the work is modernizing CAPI use to the >=2.6 standard; the only Py3-specific changes are related to str/unicode and the different signature for module initialization.