code: def _write_str(self, data):
          
          with self.__lock:
              self.output.write(
                  to_str(data, self.encoding)
                  .encode()
                  .decode(self.out_encoding, errors="replace")
              )
docs: Converts the given data then writes it
  
          :param data: Data to be written
          :return: The result of ``self.output.write()``