end of function connect

def connect(self):
        if self._sStatus != 'opened':
            print "Netconf Connection: Invalid Status, Could not connect to %s:%s" % (self._sHost, self._uPort)
            sys.exit()
        # establish ssh connection
        if self._sType == 'ssh':
            # setup transport connection base on socket
            self._hSsh = paramiko.Transport(self._iSock) 
            try:
                self._hSsh.start_client()
            except paramiko.SSHException:
                print 'Netconf Connection: Connect negotiation failed'
                self._iSock.close()
                sys.exit()
            except:
                print 'Netconf Connection: Connect failed'
                try:
                    self._iSock.close()
                except:
                    pass
                sys.exit()
            # auth check
            if self._sPswd != '':
                try:
                    self._hSsh.auth_password(self._sUser, self._sPswd)
                except:
                    print "Netconf Connection: Auth SSH username/password fail"
                    self._iSock.close()
                    sys.exit()
            # open channel for netconf ssh subsystem
            try:
                self._hSshChn = self._hSsh.open_session()
                self._hSshChn.settimeout(5)
                self._hSshChn.set_name("netconf")
                self._hSshChn.invoke_subsystem("netconf")
                self._hSshChn.setblocking(1)
            except:
                print "Netconf Connection: Open SSH Netconf SubSystem fail"
                self._iSock.close()
                sys.exit()
        else:
            print "Netconf Connection: Unsupport Connection Type, Could not connect to %s:%s" % (self._sHost, self._uPort)
            sys.exit()

        self._sStatus = 'connected'

        """ end of function connect """