My answer works in C++, but it was wrong in Python. Could someone please help?? Thanks a lot!!

```
bool isSameTree(TreeNode *p, TreeNode *q) {
if (!p || !q) return p == q;
else
return (p->val == q->val) && isSameTree(p->left,q->left) && isSameTree(p->right,q->right); }
```

The above works. However, I don't know what's wrong with my Python code:

```
def isSameTree(self, p, q):
if p == None or q == None:
return p == q
else:
return p.val == q.val and self.isSameTree(p.left,q.left) and self.isSameTree(q.right, p.right)
```

OJ says Runtime Error