code: def flush(self):
          
          if not self._buffer:
              # Only flush stdout buffer. (It could be that Python still has
              # something in its buffer. -- We want to be sure to print that in
              # the correct color.)
              self.stdout.flush()
              return
  
          data = ''.join(self._buffer)
  
          if _DEBUG_RENDER_OUTPUT:
              self.LOG.write(('%r' % data).encode('utf-8') + b'\n')
              self.LOG.flush()
  
          # Print characters one by one. This appears to be the best soluton
          # in oder to avoid traces of vertical lines when the completion
          # menu disappears.
          for b in data:
              written = DWORD()
  
              retval = windll.kernel32.WriteConsoleW(self.hconsole, b, 1, byref(written), None)
              assert retval != 0
  
          self._buffer = []
docs: Write to output stream and flush.