vals_str2 = ', '.join(['%({0})s'.format(x) for x in cols])
cursor.execute('INSERT INTO song_table ({cols}) VALUES ({vals_str})'.format
    (cols=cols, vals_str=vals_str2), song)
Insert Python Dictionary using Psycopg2