def insert_with_key_enumeration(agent, agent_data: list, results: dict):
    """
    Checks if agent with the same name has stored data already in the given dict and enumerates in that case
    :param agent: agent that produced data
    :param agent_data: simulated data
    :param results: dict to store data into
    :return: dict with inserted data/name pair
    """
    # add to results dict and don't double agent names
    if agent.get_name() not in results:
        results[agent.get_name()] = agent_data
    else:
        # add index to agent name if another agent of same type was simulated before
        new_name = agent.get_name() + "_" + str(
            sum([agent.get_name() in s for s in list(results.keys())]))
        results[new_name] = agent_data
    return results