code: def _write_transport(self, string):
          
          if isinstance(string, str):  # we need to convert to bytes
              self.transport.write(string.encode('utf-8'))
          else:
              self.transport.write(string)
docs: Convenience function to write to the transport