code: def _RemoveIllegalXMLCharacters(self, xml_string):
      
      if not isinstance(xml_string, py2to3.STRING_TYPES):
        return xml_string
  
      return self._ILLEGAL_XML_RE.sub('\ufffd', xml_string)
docs: Removes illegal characters for XML.
  
      If the input is not a string it will be returned unchanged.
  
      Args:
        xml_string (str): XML with possible illegal characters.
  
      Returns:
        str: XML where all illegal characters have been removed.