Mirror a tree

Write mirror(root) that swaps the left and right children of every node, so the tree becomes its mirror image, and returns the root. Change the tree in place.

mirror([8, 3, 10, 1, 6, None, 14])  ->  [8, 10, 3, 14, None, 6, 1]
mirror(None)                        ->  None

The point is to practise a recursion that changes the tree rather than computing a number from it.

def mirror(root):
    ...