code: def main():
      parser = OptionParser()
      parser.set_defaults(n=100)
      parser.set_defaults(tmin=1e-3)
      parser.set_defaults(tmax=1)
      parser.set_defaults(profile="default")
  
      parser.add_option(
          "-n", type="int", dest="n", help="the number of tasks to run"
      )
      parser.add_option(
          "-t",
          type="float",
          dest="tmin",
          help="the minimum task length in seconds",
      )
      parser.add_option(
          "-T",
          type="float",
          dest="tmax",
          help="the maximum task length in seconds",
      )
      parser.add_option(
          "-p",
          "--profile",
          type="str",
          dest="profile",
          help="the cluster profile [default: 'default']",
      )
  
      (opts, args) = parser.parse_args()
      assert (
          opts.tmax >= opts.tmin
      ), "tmax must not be smaller than tmin"
  
      rc = ipp.Client()
      view = rc.load_balanced_view()
      print(view)
      rc.block = True
      nengines = len(rc.ids)
  
      # the jobs should take a random time within a range
      times = [
          random.random() * (opts.tmax - opts.tmin) + opts.tmin
          for i in range(opts.n)
      ]
      stime = sum(times)
  
      print(
          "executing %i tasks, totalling %.1f secs on %i engines"
          % (opts.n, stime, nengines)
      )
      time.sleep(1)
      start = time.perf_counter()
      amr = view.map(time.sleep, times)
      amr.get()
      stop = time.perf_counter()
  
      ptime = stop - start
      scale = stime / ptime
  
      print(f"executed {stime:.1f} secs in {ptime:.1f} secs")
      print(
          "%.3fx parallel performance on %i engines" % (scale, nengines)
      )
      print("%.1f%% of theoretical max" % (100 * scale / nengines))
  
imports: import random
  import time
  from optparse import OptionParser
  import ipyparallel
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types