code: def run(cmd, repeat=10):
      print("sampling:", end=" ")
      sys.stdout.flush()
  
      samples = []
      for _ in range(repeat):
          start = time.time()
          subprocess.call(cmd, stdout=devnull, stderr=devnull)
          end = time.time()
          dt = (end - start) * 1000
          print("%dms" % int(dt), end=" ")
          sys.stdout.flush()
          samples.append(dt)
      print()
  
      # We're interested in the 'pure' runtime of the code, which is
      # conceptually the smallest time we'd see if we ran it enough times
      # such that it got the perfect time slices / disk cache hits.
      best = min(samples)
      # Also print how varied the outputs were in an attempt to make it
      # more obvious if something has gone terribly wrong.
      err = sum(s - best for s in samples) / float(len(samples))
      print("estimate: %dms (mean err %.1fms)" % (best, err))
  
imports: import time
  import subprocess
  import sys
label_desc: Use image node_id 1 for calling a global function with example usage: run(cmd, repeat) without return types