def filter_events(self, events, filter_dict, expect_one=False):
        events_to_return = events
        for k, v in filter_dict.iteritems():
            if isinstance(v, str):
                v = [v]
            events_to_return = ([event for event in events_to_return if
                self._get_nested_dict_value(event, k.split('.')) in v])
        if expect_one:
            self.assertEqual(len(events_to_return), 1)
            if events_to_return:
                return events_to_return[0]
        return events_to_return

    # PARAMETER TESTS
Returns only events matching the filter_dict.
dataset/ETHPy150Open Kloudless/kloudless-python/tests/integration/test_cases/test_events.py/Events.filter_events