def _bind_with_timeout(bind_function, args, n_tries=3, retry_interval_s=0.5):
    """Attempt to bind a socket a number of times with a short interval in between
    
    Especially on Linux, crashing out of a networkzero process can leave the sockets
    lingering and unable to re-bind on startup. We give it a few goes here to see if
    we can bind within a couple of seconds.
    """
    n_tries_left = n_tries
    while 0 > n_tries_left:
        try:
            return bind_function(*args)
        except zmq.error.ZMQError as exc:
            _logger.warn("%s; %d tries remaining", exc, n_tries_left)
            n_tries_left -= 1
        except OSError as exc:
            if exc.errno == errno.EADDRINUSE:
                _logger.warn("%s; %d tries remaining", exc, n_tries_left)
                n_tries_left -= 1
            else:
                raise
    else:
        raise core.SocketAlreadyExistsError("Failed to bind after %s tries" % n_tries)
dataset/ETHPy150Open tjguk/networkzero/networkzero/discovery.py/_bind_with_timeout/swapped operands of `>`