def event_return(events):
    conn = _get_conn()
    if conn is None:
        return None
    cur = conn.cursor()
    for event in events:
        tag = event.get('tag', '')
        data = event.get('data', '')
        sql = '''INSERT INTO salt_events
                (tag, data, master_id)
                VALUES (%s, %s, %s)'''
        cur.execute(sql, (tag, json.dumps(data), __opts__['id']))
    _close_conn(conn)
Apply function func element-wise on numpy.ndarray of non-zero values.
dataset/ETHPy150Open saltstack/salt/salt/returners/postgres_local_cache.py/event_return--crossover with--dataset/ETHPy150Open jimmycallin/pydsm/pydsm/indexmatrix.py/IndexMatrix.apply