295
299
# represented in well-formed XML; escape characters that
296
300
# aren't listed in the XML specification
297
301
# (http://www.w3.org/TR/REC-xml/#NT-Char).
304
302
self.message, escape_count = re.subn(
306
304
lambda match: match.group(0).encode('unicode_escape'),