Bytes and str conversions for Python 3