'Get the interval to the next timeout event, or a default interval'

def _get_next_deadline(self):

    if self._next_timeout:
        timeout = max((self._next_timeout - time.time()), 0)
    elif self._timeouts:
        deadlines = [t['deadline'] for t in self._timeouts.values()]
        self._next_timeout = min(deadlines)
        timeout = max(((self._next_timeout - time.time()), 0))
    else:
        timeout = self._MAX_POLL_TIMEOUT
    timeout = min(timeout, self._MAX_POLL_TIMEOUT)
    return (timeout * self.POLL_TIMEOUT_MULT)
