docs: def connect(server, password=None,
          factory_class=VNCDoToolFactory, proxy=ThreadedVNCClientProxy, timeout=None):
      """ Connect to a VNCServer and return a Client instance that is usable
      in the main thread of non-Twisted Python Applications, EXPERIMENTAL.
  
      >>> from vncdotool import api
      >>> with api.connect('host') as client
      >>>     client.keyPress('c')
  
      You may then call any regular VNCDoToolClient method on client from your
      application code.
  
      If you are using a GUI toolkit or other major async library please read
      http://twistedmatrix.com/documents/13.0.0/core/howto/choosing-reactor.html
      for a better method of intergrating vncdotool.
      """
      if not reactor.running:
          global _THREAD
          _THREAD = threading.Thread(target=reactor.run, name='Twisted',
                           kwargs={'installSignalHandlers': False})
          _THREAD.daemon = True
          _THREAD.start()
  
          observer = PythonLoggingObserver()
          observer.start()
  
      factory = factory_class()
  
      if password is not None:
          factory.password = password
  
      family, host, port = command.parse_server(server)
      client = proxy(factory, timeout)
      client.connect(host, port=port, family=family)
  
      return client