async def wait_for_server(ip, port, timeout=10):
    """Wait for any server to show up at ip:port."""
    if ip in {'', '0.0.0.0', '::'}:
        ip = '127.0.0.1'
    app_log.debug("Waiting %ss for server at %s:%s", timeout, ip, port)
    tic = time.perf_counter()
    await exponential_backoff(
        lambda: can_connect(ip, port),
        f"Server at {ip}:{port} didn't respond in {timeout} seconds",
        timeout=timeout,
    )
    toc = time.perf_counter()
    app_log.debug("Server at %s:%s responded in %.2fs", ip, port, toc - tic)
Wait for any server to show up at ip:port.
jupyterhub/utils.py