code: def validate_url(self, url):
          
          # fix up the non-ascii path
          url_path = to_bytes_safe(url.path)
          url_path = urllib.parse.quote(url_path, safe=b"/%")
  
          # fix up the non-ascii query
          url_query = to_bytes_safe(url.query)
          url_query = urllib.parse.quote(url_query, safe=b"?=&")
  
          url = urllib.parse.ParseResult(url.scheme, url.netloc, url_path,
                                         url.params, url_query, url.fragment)
  
          # validate the components of URL
          has_hostname = url.hostname is not None and len(url.hostname) > 0
          has_http_scheme = url.scheme in ("http", "https")
          has_path = not len(url.path) or url.path.startswith("/")
  
          if not (has_hostname and has_http_scheme and has_path):
              raise NotSupported("invalid url: %s" % repr(url))
  
          return url
docs: Validate the :class:`~urllib.parse.ParseResult` object.
  
          This method will make sure the :meth:`~brownant.app.BrownAnt.parse_url`
          could work as expected even meet a unexpected URL string.
  
          :param url: the parsed url.
          :type url: :class:`~urllib.parse.ParseResult`