<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def import_from_sqlite( filename_or_connection, table_name="table1", query=None, query_args=None, *args, **kwargs ):
 """Return a rows.Table with data from SQLite database."""

    source = get_source(filename_or_connection)
    connection = source.fobj
    cursor = connection.cursor()

    if query is None:
        if not _valid_table_name(table_name):
            raise ValueError("Invalid table name: {}".format(table_name))

        query = SQL_SELECT_ALL.format(table_name=table_name)

    if query_args is None:
        query_args = tuple()

    table_rows = list(cursor.execute(query, query_args))  # TODO: may be lazy
    header = [six.text_type(info[0]) for info in cursor.description]
    cursor.close()
    # TODO: should close connection also?

    meta = {"imported_from": "sqlite", "source": source}
    return create_table([header] + table_rows, meta=meta, *args, **kwargs)