Python 2 __repr__ and __str__ compatiblity fix