if res is not NotImplemented:
    return res
if op == '__eq__':
    res = v is w
elif op == '__ne__':
    res = v is not w
else:
    raise TypeError('sth')
return res
Returning NotImplemented from __eq__