code: def _write_bytes(self, data):
          
          with self.__lock:
              self.output.write(to_bytes(data, self.encoding))
docs: Converts the given data then writes it
  
          :param data: Data to be written
          :return: The result of ``self.output.write()``