<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_sqlite3_by_table(self, conn, table_name):
 """ Saves the sequence to the specified table of sqlite3 database. Each element can be a dictionary, namedtuple, tuple or list. Target table must be created in advance. :param conn: path or sqlite connection, cursor :param table_name: table name string """

        def _insert_item(item):
            if isinstance(item, dict):
                cols = ', '.join(item.keys())
                placeholders = ', '.join('?' * len(item))
                sql = 'INSERT INTO {} ({}) VALUES ({})'.format(table_name, cols, placeholders)
                conn.execute(sql, tuple(item.values()))
            elif is_namedtuple(item):
                cols = ', '.join(item._fields)
                placeholders = ', '.join('?' * len(item))
                sql = 'INSERT INTO {} ({}) VALUES ({})'.format(table_name, cols, placeholders)
                conn.execute(sql, item)
            elif isinstance(item, (list, tuple)):
                placeholders = ', '.join('?' * len(item))
                sql = 'INSERT INTO {} VALUES ({})'.format(table_name, placeholders)
                conn.execute(sql, item)
            else:
                raise TypeError('item must be one of dict, namedtuple, tuple or list got {}'
                                .format(type(item)))

        self.for_each(_insert_item)