code: def wait_for_nodes(expected):
      # Wait for all nodes to join the cluster.
      while True:
          num_nodes = len(ray.nodes())
          if num_nodes < expected:
              print(
                  "{} nodes have joined so far, waiting for {} more.".format(
                      num_nodes, expected - num_nodes
                  )
              )
              sys.stdout.flush()
              time.sleep(1)
          else:
              break
  
imports: import sys
  import time
  from collections import Counter
  import ray
label_desc: Use image node_id 2 for calling a global function with example usage: wait_for_nodes(expected) without return types