<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_insert(table, d):
 """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 ('insert into doc.foobar ("name") values (?)', ['Marvin']) """


    columns = []
    args = []
    for key, val in d.items():
        columns.append('"{}"'.format(key))
        args.append(val)
    stmt = 'insert into {table} ({columns}) values ({params})'.format(
        table=table,
        columns=', '.join(columns),
        params=', '.join(['?'] * len(columns)))
    return (stmt, args)