code: def percent_encode_host(url):
          
  
          # only continue if punycode encoded
          if 'xn--' not in url:
              return url
  
          parts = urlsplit(url)
          domain = parts.netloc.encode('utf-8')
          try:
              domain = domain.decode('idna')
              if six.PY2:
                  domain = domain.encode('utf-8', 'ignore')
          except:
              # likely already encoded, so use as is
              pass
  
          domain = quote(domain)#, safe=r':\/')
  
          return urlunsplit((parts[0], domain, parts[2], parts[3], parts[4]))
docs: Convert the host of uri formatted with to_uri()
          to have a %-encoded host instead of punycode host
          The rest of url should be unchanged