def save_state(self, task_id, result, previous):
        new_state = self.build_new_state(task_id, result, previous)
        expected_value = ['last_update', False]
        if previous:
            expected_value = ['last_update', previous.last_update.isoformat()]
            if previous.last_update > new_state.last_update:
                logger.warning(task_id + " - found previous state that is "
                               "newer than current state.  Discarding.")
                logger.warning(task_id + " - previous state: %s",
                               previous.to_primitive())
                logger.warning(task_id + " - current state: %s",
                               new_state.to_primitive())
                raise OutOfDateState(new_state, previous)
        logger.debug(task_id + " - saving state: %s",
                     new_state.to_primitive())
        try:
            self.domain.put_attributes(task_id, new_state.to_primitive(),
                                       replace=True,
                                       expected_value=expected_value)
        except SDBResponseError as e:
            if e.error_code == 'ConditionalCheckFailed':
                logger.warning('last_update for %s was updated, skipping',
                               task_id)
                return
            raise
dataset/ETHPy150Open cloudtools/nymms/nymms/state/sdb_state.py/SDBStateManager.save_state/original