code: def tree_build(self):
          
          from skbio.tree import TreeNode
  
          # build all the nodes
          nodes = {}
  
          for tax_id in self.taxonomy.index:
              node = TreeNode(name=tax_id, length=1)
              node.tax_name = self.taxonomy["name"][tax_id]
              node.rank = self.taxonomy["rank"][tax_id]
              node.parent_tax_id = self.taxonomy["parent_tax_id"][tax_id]
  
              nodes[tax_id] = node
  
          # generate all the links
          for tax_id in self.taxonomy.index:
              try:
                  parent = nodes[nodes[tax_id].parent_tax_id]
              except KeyError:
                  if tax_id != "1":
                      warnings.warn(
                          "tax_id={} has parent_tax_id={} which is not in tree"
                          "".format(tax_id, nodes[tax_id].parent_tax_id)
                      )
  
                  continue
  
              parent.append(nodes[tax_id])
  
          return nodes["1"]
docs: Build a tree from the taxonomy data present in this `ClassificationsDataFrame` or
          `SampleCollection`.
  
          Returns
          -------
          `skbio.tree.TreeNode`, the root node of a tree that contains all the taxa in the current
          analysis and their parents leading back to the root node.