code: def print_generic(self, n=50, method="time"):
      slowest = sorted(
          (getattr(node, method)(), node.name())
          for node in self.linearize()
      )[-n:]
      for time, name in slowest[::-1]:
          print("%s %s" % (time, name))
  
imports: from __future__ import print_function
  import timeit
  from sympy import *
label_desc: Use image node_id 12 for calling the TreeNode obj's underlying member method code with example usage: obj.print_generic(n, method) without return types