def xtext_decode(s, errors=None):
    """
    Decode the xtext-encoded string C{s}.

    @param s: String to decode.
    @param errors: codec error handling scheme.
    @return: The decoded string.
    """
    r = []
    i = 0
    while i < len(s):
        if s[i:i+1] == b'+':
            try:
                r.append(chr(int(bytes(s[i + 1:i + 3]), 16)))
            except ValueError:
                r.append(ord(s[i:i + 3]))
            i += 3
        else:
            r.append(bytes(s[i:i+1]).decode('ascii'))
            i += 1
    return (''.join(r), len(s))

    Decode the xtext-encoded string C{s}.

    @param s: String to decode.
    @param errors: codec error handling scheme.
    @return: The decoded string.
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/smtp.py