code: def timer(s, v="", nloop=500, nrep=3):
      units = ["s", "ms", "µs", "ns"]
      scaling = [1, 1e3, 1e6, 1e9]
      print("%s : %-50s : " % (v, s), end=" ")
      varnames = ["%ss,nm%ss,%sl,nm%sl" % tuple(x * 4) for x in "xyz"]
      setup = "from __main__ import numpy, ma, %s" % ",".join(varnames)
      Timer = timeit.Timer(stmt=s, setup=setup)
      best = min(Timer.repeat(nrep, nloop)) / nloop
      if best > 0.0:
          order = min(-int(numpy.floor(numpy.log10(best)) // 3), 3)
      else:
          order = 3
      print(
          "%d loops, best of %d: %.*g %s per loop"
          % (nloop, nrep, 3, best * scaling[order], units[order])
      )
  
imports: from __future__ import division, print_function
  import timeit
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: timer(s, v, nloop, nrep) without return types