def _xml_escape_attr(attr, skip_single_quote=True):
escaped = (attr<EOL>.replace('<STR_LIT:&>', '<STR_LIT>')<EOL>.replace('<STR_LIT:">', '<STR_LIT>')<EOL>.replace('<STR_LIT:<>', '<STR_LIT>')<EOL>.replace('<STR_LIT:>>', '<STR_LIT>'))<EOL>if not skip_single_quote:<EOL><INDENT>escaped = escaped.replace("<STR_LIT:'>", "<STR_LIT>")<EOL><DEDENT>return escaped<EOL>
Escape the given string for use in an HTML/XML tag attribute.

    By default this doesn't bother with escaping `'` to `&#39;`, presuming that
    the tag attribute is surrounded by double quotes.