class_docstr: Tree node data structure
  
  Nodes have an attribute item to carry arbitrary information. A node may only have one parent
  and can have as many children as desired.
  
  Parents can be set at initialization or via `node.set_parent`. Setting a parent automatically
  set the current node as the child of the parent.
  
  Children can be set at initialization or via `node.add_children`. Setting children
  automatically set their parent as the current node.
  
  Tree of nodes are iterable, by default with preorder traversal.
  
  .. seealso::
      `orion.core.utils.tree.PreOrderTraversal`
      `orion.core.utils.tree.DepthFirstTraversal`
  
  Attributes
  ----------
  item: T
      Can be anything
  parent: None or instance of `orion.core.utils.tree.TreeNode`
      The parent of the current node, None if the current node is the root.
  children: None or list of instances of `orion.core.utils.tree.TreeNode`
      The children of the current node.
  root: instance of `orion.core.utils.tree.TreeNode`
      The top node of the current tree. The root node returns itself.
  
  Examples
  --------
  .. code-block:: python
      :linenos:
  
      a = TreeNode("a")
      b = TreeNode("b", a)
      c = TreeNode("c", a)
      d = TreeNode("d", a)
      e = TreeNode("e", a)
  
      f = TreeNode("f", b)
      g = TreeNode("g", b)
  
      h = TreeNode("h", e)
  
      # Gives this tree
      # a
      # |   \  \   \
      # b    c  d   e
      # | \         |
      # f  g        h
  
      g.set_parent(e)
  
      # Gives this tree
      # a
      # |  \  \   \
      # b   c  d   e
      # |          | \
      # f          h g
  
      c.add_children(h, g)
  
      # Gives this tree
      # a
      # |  \    \   \
      # b   c    d   e
      # |   | \
      # f   h  g
  
      a.drop_children(c)
  
      # Gives this tree
      # a
      # |  \   \
      # b   d   e
      # |
      # f
class_docstr_tok: ["Tree","node","data","structure","Nodes","have","an","attribute","item","to","carry","arbitrary","information",".","A","node","may","only","have","one","parent","and","can","have","as","many","children","as","desired",".","Parents","can","be","set","at","initialization","or","via","`","node.set_parent","`",".","Setting","a","parent","automatically","set","the","current","node","as","the","child","of","the","parent",".","Children","can","be","set","at","initialization","or","via","`","node.add_children","`",".","Setting","children","automatically","set","their","parent","as","the","current","node",".","Tree","of","nodes","are","iterable",",","by","default","with","preorder","traversal",".","..","seealso",":",":","`","orion.core.utils.tree.PreOrderTraversal","`","`","orion.core.utils.tree.DepthFirstTraversal","`","Attributes","--","--","--","--","--","item",":","T","Can","be","anything","parent",":","None","or","instance","of","`","orion.core.utils.tree.TreeNode","`","The","parent","of","the","current","node",",","None","if","the","current","node","is","the","root",".","children",":","None","or","list","of","instances","of","`","orion.core.utils.tree.TreeNode","`","The","children","of","the","current","node",".","root",":","instance","of","`","orion.core.utils.tree.TreeNode","`","The","top","node","of","the","current","tree",".","The","root","node","returns","itself",".","Examples","--","--","--","--","..","code-block",":",":","python",":","linenos",":","a","=","TreeNode","(","``","a","''",")","b","=","TreeNode","(","``","b","''",",","a",")","c","=","TreeNode","(","``","c","''",",","a",")","d","=","TreeNode","(","``","d","''",",","a",")","e","=","TreeNode","(","``","e","''",",","a",")","f","=","TreeNode","(","``","f","''",",","b",")","g","=","TreeNode","(","``","g","''",",","b",")","h","=","TreeNode","(","``","h","''",",","e",")","#","Gives","this","tree","#","a","#","|","\\","\\","\\","#","b","c","d","e","#","|","\\","|","#","f","g","h","g.set_parent","(","e",")","#","Gives","this","tree","#","a","#","|","\\","\\","\\","#","b","c","d","e","#","|","|","\\","#","f","h","g","c.add_children","(","h",",","g",")","#","Gives","this","tree","#","a","#","|","\\","\\","\\","#","b","c","d","e","#","|","|","\\","#","f","h","g","a.drop_children","(","c",")","#","Gives","this","tree","#","a","#","|","\\","\\","#","b","d","e","#","|","#","f"]
docstr: Get item of the node which may contain arbitrary objects
docstr_tok: ["Get","item","of","the","node","which","may","contain","arbitrary","objects"]
code: def item(self) -> T:
      """Get item of the node which may contain arbitrary objects"""
      return self._item
  
imports: from __future__ import annotations
  from typing import Callable, Generic, Iterable, Iterator, Sequence, TypeVar
label_desc: Use image node_id 2 for calling the TreeNode obj's underlying member method code with example usage: obj.item() and returns: self