docs: def __Build(leaves):
          """
          Build the merkle tree.
  
          Args:
              leaves (list): items are of type MerkleTreeNode.
  
          Returns:
              MerkleTreeNode: the root node.
          """
          if len(leaves) < 1:
              raise Exception('Leaves must have length')
          if len(leaves) == 1:
              return leaves[0]
  
          num_parents = int((len(leaves) + 1) / 2)
          parents = [MerkleTreeNode() for i in range(0, num_parents)]
  
          for i in range(0, num_parents):
              node = parents[i]
              node.LeftChild = leaves[i * 2]
              leaves[i * 2].Parent = node
              if (i * 2 + 1 == len(leaves)):
                  node.RightChild = node.LeftChild
              else:
                  node.RightChild = leaves[i * 2 + 1]
                  leaves[i * 2 + 1].Parent = node
  
              hasharray = bytearray(node.LeftChild.Hash.ToArray() + node.RightChild.Hash.ToArray())
              node.Hash = UInt256(data=Crypto.Hash256(hasharray))
  
          return MerkleTree.__Build(parents)