class codecs.StreamRecoder(stream, encode, decode, Reader, Writer, errors)
Creates a StreamRecoder instance which implements a two-way conversion: encode and decode work on the frontend — the data visible to code calling read() and write(), while Reader and Writer work on the backend — the data in stream.
You can use these objects to do transparent transcodings from e.g. Latin-1 to UTF-8 and back.
The stream argument must be a file-like object.
The encode and decode arguments must adhere to