Python: also stress serialization exceptions for the JSON encoder.
Fix docstring.