```
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param {TreeNode} root
# @return {boolean}
def isSymmetric(self, root):
def checkSym(fst, snd):
if fst is None and snd is None:
return True
if fst is None or snd is None:
return False
if fst.val != snd.val:
return False
return checkSym(fst.left, snd.right) and checkSym(fst.right, snd.left)
if root is None:
return True
return checkSym(root.left, root.right)
```