def alarm_destroy_by_ids(self, alarm_id, entity_instance_id):
    with _session_for_write() as session:
        query = model_query(models.Alarm, session=session)
        if (alarm_id and entity_instance_id):
            query = query.filter_by(alarm_id=alarm_id)
            query = query.filter_by(entity_instance_id=entity_instance_id)
        try:
            query.one()
        except NoResultFound:
            raise exceptions.AlarmNotFound(alarm=alarm_id)
        query.delete()
def alarm_destroy_by_ids(self, alarm_id, entity_instance_id):
    with _session_for_write() as session:
        query = model_query(models.Alarm, session=session)
        if (alarm_id and entity_instance_id):
            query = query.filter_by(alarm_id=alarm_id)
            query = query.filter_by(entity_instance_id=entity_instance_id)
        try:
            query.one()
        except NoResultFound:
            raise exceptions.AlarmNotFound(alarm=alarm_id)
        query.delete()