<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _clean_for_xml(data):
 """ Sanitize any user-submitted data to ensure that it can be used in XML """


    # If data is None or an empty string, don't bother
    if data:
        # This turns a string like "Hello…" into "Hello&#8230;"
        data = data.encode("ascii", "xmlcharrefreplace").decode("ascii")
        # However it's still possible that there are invalid characters in the string,
        # so simply remove any of those characters
        return _illegal_xml_chars_re.sub("", data)
    return data