code: def wait_until_online(function, ip, port):
      
      awaiting_service = Wait_For_State(lambda: not is_port_available(ip, port), function)
      awaiting_service.start()
      return awaiting_service
docs: Uses Wait_For_State to wait for the server to come online, then runs the given function.