Eliminate PyString_AsString() calls

For Python 3 compatibility, pycompat.hpp #defines PyString_AsString to
PyUnicode_AsUTF8.  Unfortunately, that function is not available until
Python 3.3, so older versions will not compile.

As an alternative to #1660, simply eliminate all uses of
PyString_AsString() in the Python module.  There are only four uses,
which can be replaced with Python 2/3 compatible PyUnicode to PyBytes
conversion, finally using PyBytes_AsString() to get the string.

This patch supports Python 2 and all versions of Python 3.  The downside
is that the number of conversions required is very ugly.  Additionally,
on Python 2, PyBytes_AsString is simply defined as PyString_AsString, so
the extra conversion to PyUnicode and back is completely useless.