code: def linearize(self):
      res = [self]
      for child in self.children():
          res.extend(child.linearize())
      return res
  
imports: from __future__ import print_function
  import timeit
  from sympy import *
label_desc: Use image node_id 10 for calling the TreeNode obj's underlying member method code with example usage: obj.linearize() and returns: res