def alarm_update(self, id, values):
    with _session_for_write() as session:
        query = model_query(models.Alarm, session=session)
        query = query.filter_by(id=id)
        count = query.update(values, synchronize_session='fetch')
        if (count != 1):
            raise exceptions.AlarmNotFound(alarm=id)
        return query.one()
def alarm_update(self, id, values):
    with _session_for_write() as session:
        query = model_query(models.Alarm, session=session)
        query = query.filter_by(id=id)
        count = query.update(values, synchronize_session='fetch')
        if (count != 1):
            raise exceptions.AlarmNotFound(alarm=id)
        return query.one()