On Python 2, the previous code did not systematically perform the decoding depending on whether or not an encoding was given.
With this PR we align the Python 2 behaviour on the sane behaviour of Python 3. This also avoids a compilation warning on Python 3 were we tested "str is str".