reduce data using flightmode selections

def reduce_by_flightmodes(self, flightmode_selections):
        '''reduce data using flightmode selections'''
        if len(flightmode_selections) == 0:
            return
        all_false = True
        for s in flightmode_selections:
            if s:
                all_false = False
        if all_false:
            # treat all false as all modes wanted'''
            return
        new_msgs = []
        idx = 0
        for m in self._msgs:
            while idx < len(self._flightmodes) and m._timestamp >= self._flightmodes[idx][2]:
                idx += 1
            if idx < len(flightmode_selections) and flightmode_selections[idx]:
                new_msgs.append(m)
        self._msgs = new_msgs
        self._count = len(new_msgs)
        self.rewind()