def _pct_escape_handler(err):
    '''
    Encoding error handler that does percent-escaping of Unicode, to be used
    with codecs.register_error
    TODO: replace use of this with urllib.parse.quote as appropriate
    '''
    chunk = err.object[err.start:err.end]
    replacements = _pct_encoded_replacements(chunk)
    return ("".join(replacements), err.end)
def _pct_escape_handler ( err ) : chunk = err . object [ err . start : err . end ] replacements = _pct_encoded_replacements ( chunk ) return ( "" . join ( replacements ) , err . end )
Encoding error handler that does percent-escaping of Unicode, to be used
    with codecs.register_error
    TODO: replace use of this with urllib.parse.quote as appropriate