code: def timing(f, *args, **kwargs):
      """
      Returns time elapsed for evaluating ``f()``. Optionally arguments
      may be passed to time the execution of ``f(*args, **kwargs)``.
  
      If the first call is very quick, ``f`` is called
      repeatedly and the best time is returned.
      """
      once = kwargs.get("once")
      if "once" in kwargs:
          del kwargs["once"]
      if args or kwargs:
          if len(args) == 1 and not kwargs:
              arg = args[0]
              g = lambda: f(arg)
          else:
              g = lambda: f(*args, **kwargs)
      else:
          g = f
      from timeit import default_timer as clock
  
      t1 = clock()
      v = g()
      t2 = clock()
      t = t2 - t1
      if t > 0.05 or once:
          return t
      for i in range(3):
          t1 = clock()
          # Evaluate multiple times because the timer function
          # has a significant overhead
          g()
          g()
          g()
          g()
          g()
          g()
          g()
          g()
          g()
          g()
          t2 = clock()
          t = min(t, (t2 - t1) / 10)
      return t
  
label_desc: Use image node_id 2 for calling a global function with example usage: timing(f) and returns: t, t