@staticmethod<EOL><INDENT>def _wrap_stream(stream):<DEDENT>
if hasattr(stream, "<STR_LIT>"):<EOL><INDENT>return io.TextIOWrapper(stream.buffer, encoding="<STR_LIT:utf-8>")<EOL><DEDENT>elif hasattr(stream, "<STR_LIT>"):<EOL><INDENT>return io.TextIOWrapper(stream, encoding="<STR_LIT:utf-8>")<EOL><DEDENT>else:<EOL><INDENT>return io.open(stream.fileno(), mode=stream.mode, encoding="<STR_LIT:utf-8>")<EOL><DEDENT>
Returns a TextIOWrapper around the given stream that handles UTF-8
        encoding/decoding.