Fix serializer __str__ under Python 3