'Revert back to the last save point, should only be used immediately
after a call to add_savepoint. If there are intervening calls to undo
or redo, behavior is undefined. This is intended to be used in the case
where you create savepoint, perform some operation, operation fails, so
revert to state before creating savepoint.'

def rewind_savepoint(self):

    if ((self.pos > 0) and (self.pos == (len(self.states) - 1))):
        self.beginRemoveRows(ROOT, self.pos, self.pos)
        self.pos -= 1
        cleanup([self.states.pop().container])
        self.endRemoveRows()
        self.dataChanged.emit(self.index(self.pos), self.index(self.pos))
        ans = self.current_container
        self.states[self.pos].message = self.states[self.pos].rewind_message
        return ans
