def create_events_dict(config):
    """Create nested events dictionary to count terminal states for each different scenario from config.py

    :param config: CrowdSim config
    :type config: Config
    :return: dictionary containing all events as keys
    :rtype: dict of dicts
    """
    # breakdown cases according to scenarios
    num_events = {
        "success": {},
        "collision": {},
        "timeout": {},
    }
    # create a set of unique keys
    scenarios = set(config.sim.train_val_sim).union(set(config.sim.test_sim))
    for key in num_events.keys():
        num_events[key]["total"] = 0
        for scenario in scenarios:
            num_events[key][scenario] = 0
    return num_events