def genStringOptData(iter_data_dict: dict, key: str) -> str:
    """Generates a string that is compatible and used in the GAMS model to overwrite parameters for time series iteration.

    Args:
        iter_data_dict (dict): dictioary that holds the time series iteration information.
        key (str): identifier that selects the correct time series iteration "scenario".

    Returns:
        str: String to write in the GAMS opt object. It will enable GAMS model to select the intended time series from iter_data GAMS table.
    """

    script = "{0}".format(
        "".join(
            [
                str(v)
                + " = "
                + "iter_data("
                + "h,"
                + "'"
                + str(k)
                + "'"
                + ","
                + "'"
                + str(key)
                + "'"
                + "); "
                for k, v in iter_data_dict[key].items()
            ]
        )
    )
    return script