'Called by IOLoop when the requested timeout has passed.'

def _handle_timeout(self):

    with stack_context.NullContext():
        self._timeout = None
        while True:
            try:
                (ret, num_handles) = self._multi.socket_action(pycurl.SOCKET_TIMEOUT, 0)
            except pycurl.error as e:
                ret = e.args[0]
            if (ret != pycurl.E_CALL_MULTI_PERFORM):
                break
        self._finish_pending_requests()
    new_timeout = self._multi.timeout()
    if (new_timeout >= 0):
        self._set_timeout(new_timeout)
