'Make sure that futures are removed from the event list when they resolve
Avoids delaying cleanup until the next send/recv event,
which may never come.'

@staticmethod
def _remove_finished_future(future, event_list):

    if getattr(future, '_pyzmq_popped', False):
        return
    for (f_idx, (f, kind, kwargs, _)) in enumerate(event_list):
        if (f is future):
            break
    else:
        return
    future._pyzmq_popped = True
    event_list.remove(event_list[f_idx])
