<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _wait_process_events(self, total_time, return_filter, end_filter):
 """Synchronously process events until a specific event is found or we timeout Args: total_time (float):
 The aproximate maximum number of seconds we should wait for the end event return_filter (callable):
 A function that returns True for events we should return and not process normally via callbacks to the IOLoop end_filter (callable):
 A function that returns True for the end event that we are looking for to stop processing. Returns: list: A list of events that matched return_filter or end_filter """


        acc = []
        delta = 0.01

        start_time = time.time()
        end_time = start_time + total_time

        while time.time() < end_time:
            events = self._process_events(lambda x: return_filter(x) or end_filter(x), max_events=1)
            acc += events

            for event in events:
                if end_filter(event):
                    return acc

            if len(events) == 0:
                time.sleep(delta)

        return acc