code: def get_ancestors(self):
      if self.par is None:
          return [self]
      res = self.par.get_ancestors()
      res.append(self)
      return res
  
imports: import json
  from typing import Dict, List, Union
label_desc: Use image node_id 2 for calling the TreeNode obj's underlying member method code with example usage: obj.get_ancestors() and returns: res, list