code: def moveRoot(root, branch):
      
      import bioio
      if root.traversalID.mid == branch:
          return bioio.newickTreeParser(bioio.printBinaryTree(root, True))
      def fn2(tree, seq):
          if seq is not None:
              return '(' + bioio.printBinaryTree(tree, True)[:-1] + ',' + seq + ')'
          return bioio.printBinaryTree(tree, True)[:-1]
      def fn(tree, seq):
          if tree.traversalID.mid == branch:
              i = tree.distance
              tree.distance /= 2
              seq = '(' + bioio.printBinaryTree(tree, True)[:-1] + ',(' + seq + ('):%s' % tree.distance) + ');'
              tree.distance = i
              return seq
          if tree.internal:
              if branch < tree.traversalID.mid:
                  seq = fn2(tree.right, seq)
                  return fn(tree.left, seq)
              else:
                  assert branch > tree.traversalID.mid
                  seq = fn2(tree.left, seq)
                  return fn(tree.right, seq)
          else:
              return bioio.printBinaryTree(tree, True)[:-1]
      s = fn(root, None)
      return bioio.newickTreeParser(s)
docs: Removes the old root and places the new root at the mid point along the given branch