library(tree) code example
Example: python tree library
# pypi, the Python Package Index, suggests tinytree, treedict, caxes,
# treelib, pyavl... these are just the top few after filtering away the
# many accidental hits (which point to specific tree such as XML ones,
# AST ones, etc, etc;-). If you clarify what you want
# to do with your trees it may be easier to suggest a specific package.
pip install treelib pyavl tinytree treedict caxes
# or
pip3 install treelib pyavl tinytree treedict caxes