def get_last_tid(self):
        try:
            spec = {'tid': {'$gt': 0}}
            sort = [('tid', -1)]
            row = self.db.docs.find_one(spec, sort=sort)
        except Exception as e:
            raise DatabaseException(e)
        if row:
            return row['tid']
        return 0
def loginSsh(self):
        self._setupLog()
        self._debugLog("Login in as "+self._loginUser.username)

        try:
            self._loginUser.sendPassword()
            return True
        except Exception as e:
            self.forceCloseCliConnectionTo()
            raise Exception('Exception ('+str(e)+') '+'Expected CLI response: "Password:"' + "\n Got: \n" + self._lastExpect())