'Increment object revision in compare and swap fashion.
Before the increment, this checks and enforces any revision number
constraints.'

def _bump_obj_revision(self, session, obj):

    if getattr(obj, '_rev_bumped', False):
        return
    (instance, match) = self._get_constrained_instance_match(session)
    if (instance and (instance == obj)):
        self._enforce_if_match_constraints(session)
    obj.bump_revision()
    setattr(obj, '_rev_bumped', True)
