def _XmlEscape(value, attr=False):
 def replace(match):
  m = match.string[match.start():match.end()]
  if (attr and (m == "'")):
   return m
  return _xml_escape_map[m]
 return _xml_escape_re.sub(replace, value)

def _XmlEscape ( value , attr = False ) : def replace ( match ) : m = match . string [ match . start ( ) : match . end ( ) ] if ( attr and ( m == "'" ) ) : return m return _xml_escape_map [ m ] return _xml_escape_re . sub ( replace , value )
escape a string for inclusion in xml .