def _percentDecode(text):
 try:
  quotedBytes = text.encode('ascii')
 except UnicodeEncodeError:
  return text
 unquotedBytes = urlunquote(quotedBytes)
 try:
  return unquotedBytes.decode('utf-8')
 except UnicodeDecodeError:
  return text

def _percentDecode ( text ) : try : quotedBytes = text . encode ( 'ascii' ) except UnicodeEncodeError : return text unquotedBytes = urlunquote ( quotedBytes ) try : return unquotedBytes . decode ( 'utf-8' ) except UnicodeDecodeError : return text
replace percent-encoded characters with their utf-8 equivalents .