Set a key/value pair in sqlite3

def set_(key, value, profile=None):
    '''
    Set a key/value pair in sqlite3
    '''
    if not profile:
        return False
    conn, cur, table = _connect(profile)
    if six.PY2:
        value = buffer(salt.utils.msgpack.packb(value))
    else:
        value = memoryview(salt.utils.msgpack.packb(value))
    q = profile.get('set_query', ('INSERT OR REPLACE INTO {0} VALUES '
                                  '(:key, :value)').format(table))
    conn.execute(q, {'key': key, 'value': value})
    conn.commit()
    return True