human
Complete the below
def _XmlEscape(value, attr=False):

    ''''Escape a string for inclusion in XML.'
    '''

Give me a the Python code you requested?
assistant
#Here is the Python code you requested.
    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)