def update_kw(table, where, *args, **kw):
    '''
    Execute update SQL by table, where, args and kw.

    >>> u1 = dict(id=900900, name='Maya', email='maya@test.org', passwd='MAYA', last_modified=time.time())
    >>> insert('user', **u1)
    1
    >>> u2 = select_one('select * from user where id=?', 900900)
    >>> u2.email
    u'maya@test.org'
    >>> u2.passwd
    u'MAYA'
    >>> update_kw('user', 'id=?', 900900, name='Kate', email='kate@example.org')
    1
    >>> u3 = select_one('select * from user where id=?', 900900)
    >>> u3.name
    u'Kate'
    >>> u3.email
    u'kate@example.org'
    >>> u3.passwd
    u'MAYA'
    '''
    if len(kw)==0:
        raise ValueError('No kw args.')
    sqls = ['update', table, 'set']
    params = []
    updates = []
    for k, v in kw.iteritems():
        updates.append('%s=?' % k)
        params.append(v)
    sqls.append(', '.join(updates))
    sqls.append('where')
    sqls.append(where)
    sql = ' '.join(sqls)
    params.extend(args)
    return update(sql, *params)
dataset/ETHPy150Open michaelliao/transwarp/transwarp/db.py/update_kw/original