def trainings(states):
    """Creates a dict from training_id to a list of game states."""
    ret_value = {}
    for state in states:
        if state.training_id not in ret_value:
            ret_value[state.training_id] = []
        ret_value[state.training_id].append(state)
    return ret_value