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 circle(self,x,y,r):
		for x_offset in range(-r,r+1):
			for y_offset in range(-r,r+1):
				if sqrt(x_offset**2+y_offset**2)<r:
					self.board[x+x_offset,y+y_offset] = self.color