docs: def connectSession(connection, protocol, sessionFactory=None, *args, **kwargs):
      """Open a SSHSession channel and connect a Protocol to it
  
      @param connection: the SSH Connection to open the session channel on
      @param protocol: the Protocol instance to connect to the session
      @param sessionFactory: factory method to generate a SSHSession instance
      @note: :args: and :kwargs: are passed to the sessionFactory
      """
      factory = sessionFactory or defaultSessionFactory
      session = factory(*args, **kwargs)
      session.dataReceived = protocol.dataReceived
      session.closed = lambda: protocol.connectionLost(connectionDone)
  
      deferred = defer.Deferred()
      @deferred.addCallback
      def connectProtocolAndReturnSession(specificData):
          protocol.makeConnection(session)
          return session
      session.sessionOpen = deferred.callback
      session.openFailed = deferred.errback
  
      connection.openChannel(session)
  
      return deferred