<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_all_futures(self, futures, timeout=None, event_timeout=None):
 # type: (Union[List[Future], Future, None], float, float) -> None """Services all futures until the list 'futures' are all done then returns. Calls relevant subscription callbacks as they come off the queue and raises an exception on abort Args: futures: a `Future` or list of all futures that the caller wants to wait for timeout: maximum total time in seconds to wait for responses, wait forever if None event_timeout: maximum time in seconds to wait between each response event, wait forever if None """

        if timeout is None:
            end = None
        else:
            end = time.time() + timeout

        if not isinstance(futures, list):
            if futures:
                futures = [futures]
            else:
                futures = []

        filtered_futures = []

        for f in futures:
            if f.done():
                if f.exception() is not None:
                    raise f.exception()
            else:
                filtered_futures.append(f)

        while filtered_futures:
            if event_timeout is not None:
                until = time.time() + event_timeout
                if end is not None:
                    until = min(until, end)
            else:
                until = end
            self._service_futures(filtered_futures, until)