def to_insert(table, d):
columns = []<EOL>args = []<EOL>for key, val in d.items():<EOL><INDENT>columns.append('<STR_LIT>'.format(key))<EOL>args.append(val)<EOL><DEDENT>stmt = '<STR_LIT>'.format(<EOL>table=table,<EOL>columns='<STR_LIT:U+002CU+0020>'.join(columns),<EOL>params='<STR_LIT:U+002CU+0020>'.join(['<STR_LIT:?>'] * len(columns)))<EOL>return (stmt, args)<EOL>
Generate an insert statement using the given table and dictionary.

    Args:
        table (str): table name
        d (dict): dictionary with column names as keys and values as values.
    Returns:
        tuple of statement and arguments

    >>> to_insert('doc.foobar', {'name': 'Marvin'})
    ('insert into doc.foobar ("name") values (?)', ['Marvin'])