'Creates a savepoint (if supported and required by the backend) inside the
current transaction. Returns an identifier for the savepoint that will be
used for the subsequent rollback or commit.'

def savepoint(self):

    thread_ident = thread.get_ident()
    self.savepoint_state += 1
    tid = str(thread_ident).replace('-', '')
    sid = ('s%s_x%d' % (tid, self.savepoint_state))
    self._savepoint(sid)
    return sid
