My code is just down here. It gives me the wrong answer nevertheless I cannot find any bug. Could someone please help?

class Solution(object):

```
def path(self, root, sum):
if not root:
return False
elif root.val == sum:
return True
return self.path(root.left, sum- root.val) or self.path(root.right, sum - root.val)
def pathSum(self, root, sum):
"""
:type root: TreeNode
:type sum: int
:rtype: int
"""
if root:
return self.path(root, sum) + self.pathSum(root.left, sum) + self.pathSum(root.right, sum)
return 0
```