def sqlinsert(table, row):
validate_name(table)<EOL>fields = sorted(row.keys())<EOL>validate_names(fields)<EOL>values = [row[field] for field in fields]<EOL>sql = "<STR_LIT>".format(<EOL>table, '<STR_LIT:U+002CU+0020>'.join(fields), '<STR_LIT:U+002CU+0020>'.join(['<STR_LIT:%s>'] * len(fields)))<EOL>return sql, values<EOL>
Generates SQL insert into table ...
    Returns (sql, parameters)

    >>> sqlinsert('mytable', {'field1': 2, 'field2': 'toto'})
    ('insert into mytable (field1, field2) values (%s, %s)', [2, 'toto'])
    >>> sqlinsert('t2', {'id': 1, 'name': 'Toto'})
    ('insert into t2 (id, name) values (%s, %s)', [1, 'Toto'])