def _index_with_as_index(self, b):
        # TODO perf, it feels like this should already be somewhere...
        from itertools import chain
        original = self._selected_obj.index
        gp = self.grouper
        levels = chain((gp.levels[i][gp.labels[i][b]]
                        for i in range(len(gp.groupings))),
                       (original.get_level_values(i)[b]
                        for i in range(original.nlevels)))
        new = MultiIndex.from_arrays(list(levels))
        new.names = gp.names + original.names
        return new
Checks where a model is active
dataset/ETHPy150Open pydata/pandas/pandas/core/groupby.py/_GroupBy._index_with_as_index--crossover with--dataset/ETHPy150Open missionpinball/mpf/mpf/system/mode_controller.py/ModeController.is_active