The error occurred in Add Two Numbers. Is there anyone who can help me?

Runtime Error Message: Line 48: Exception: Type <type 'instance'>: Not implemented

Last executed input: [0], [0]

```
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @param {ListNode} l1
# @param {ListNode} l2
# @return {ListNode}
def addTwoNumbers(self, l1, l2):
ret = ListNode(0)
cur = ret
while True:
if l1:
cur.val += l1.val
l1 = l1.next
if l2:
cur.val += l2.val
l2 = l2.next
carry = cur.val // 10
cur.val %= 10
if l1 or l2 or carry:
cur.next = ListNode(carry)
cur = cur.next
else:
break
return ret
```