def create_time_periods(connector, future_years):
    """
    This function writes the time_periods table to an sqlite
    database. Only "future" time periods will be written.

    Parameters
    ----------
    connector : sqlite3 connection object
        An object for connecting to a specific SQLite
        database.

    future_years : list or array
        The yearly resolution of the energy system model.

    Returns
    -------
    table_command : string
        The command for generating the "time_periods" table.
    """

    table_command = """CREATE TABLE "time_periods" (
                    	"t_periods"	integer,
                    	"flag"	text,
                    	PRIMARY KEY("t_periods"),
                    	FOREIGN KEY("flag") REFERENCES "time_period_labels"("t_period_labels")
                    );"""
    insert_command = """
                     INSERT INTO "time_periods" VALUES(?,?)
                     """

    time_horizon = [(int(year), 'f') for year in future_years]
    # set boundary year
    time_horizon.append((int(future_years[-1] + 1), 'f'))
    cursor = connector.cursor()
    cursor.execute(table_command)
    cursor.executemany(insert_command, time_horizon)
    connector.commit()
    return table_command