```
def invertTree(self, root):
if not root: return root
# Invert the left and right of current tree
root.left, root.right = root.right, root.left
# Recursively invert left and right sub trees
self.invertTree(root.left)
self.invertTree(root.right)
return root
```