241
244
# represented in well-formed XML; escape characters that
242
245
# aren't listed in the XML specification
243
246
# (http://www.w3.org/TR/REC-xml/#NT-Char).
250
247
self.message, escape_count = re.subn(
252
249
lambda match: match.group(0).encode('unicode_escape'),