def create_commodities(connector, comm_data):
    """
    Writes a ``commodities`` table to an SQLite database.

    Parameters
    ----------
    connector : sqlite3 connection object
        Used to connect to and write to an sqlite database.

    comm_data : dictionary
        A dictionary of Commodity objects with keys
        * demand
        * resources
        * emissions

    Returns
    -------
    table_command : string
        The command for generating the "commodities" table.
    """
    table_command = """CREATE TABLE "commodities" (
                    	"comm_name"	text,
                    	"flag"	text,
                    	"comm_desc"	text,
                    	PRIMARY KEY("comm_name"),
                    	FOREIGN KEY("flag") REFERENCES "commodity_labels"("comm_labels")
                    );"""
    insert_command = """
                     INSERT INTO "commodities" VALUES(?,?,?)
                     """
    demand_entries = [comm._db_entry() for comm in comm_data['demand']]
    resource_entries = [comm._db_entry() for comm in comm_data['resources']]
    emission_entries = [comm._db_entry() for comm in comm_data['emissions']]

    labels = demand_entries + resource_entries + emission_entries

    cursor = connector.cursor()
    cursor.execute(table_command)
    cursor.executemany(insert_command, labels)
    connector.commit()

    return table_command