<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _groupby_new_state(index, outputs, decisions):
 """Groups the simulants in the index by their new output state. Parameters index : iterable of ints An iterable of integer labels for the simulants. outputs : iterable A list of possible output states. decisions : `pandas.Series` A series containing the name of the next state for each simulant in the index. Returns ------- iterable of 2-tuples The first item in each tuple is the name of an output state and the second item is a `pandas.Index` representing the simulants to transition into that state. """

    output_map = {o: i for i, o in enumerate(outputs)}
    groups = pd.Series(index).groupby([output_map[d] for d in decisions])
    results = [(outputs[i], pd.Index(sub_group.values)) for i, sub_group in groups]
    selected_outputs = [o for o, _ in results]
    for output in outputs:
        if output not in selected_outputs:
            results.append((output, pd.Index([])))
    return results