code: 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.endf _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)
docs: 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