Py3K-friendly string conversion