code: def remodelTreeRemovingRoot(root, node):
      
      import bioio
      assert root.traversalID.mid != node
      hash = {}
      def fn(bT):
          if bT.traversalID.mid == node:
              assert bT.internal == False
              return [ bT ]
          elif bT.internal:
              i = fn(bT.left)
              if i is None:
                  i = fn(bT.right)
              if i is not None:
                  hash[i[-1]]= bT
                  i.append(bT)
              return  i
          return None
      l = fn(root)
      def fn2(i, j):
          if i.left == j:
              return i.right
          assert i.right == j
          return i.left
      def fn3(bT):
          if hash[bT] == root:
              s = '(' + bioio.printBinaryTree(fn2(hash[bT], bT), bT, True)[:-1] + ')'
          else:
              s = '(' + bioio.printBinaryTree(fn2(hash[bT], bT), bT, True)[:-1] + ',' + fn3(hash[bT]) + ')'
          return s + ":" + str(bT.distance)
      s = fn3(l[0]) + ';'
      t = bioio.newickTreeParser(s)
      return t
docs: Node is mid order number