text: #!/usr/bin/env python3
  # -*- coding: utf-8 -*-
  
  import re
  
  from wire.helpers import logging
  
  from wire.exceptions import InvalidURLException
  
  URL_REGEX = re.compile(
      r"^(?:http|ftp)s?://"
      r"(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|"
      r"localhost|"
      r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
      r"(?::\d+)?"
      r"(?:/?|[/?]\S+)$",
      re.IGNORECASE,
  )
  
  
  def validate_url(url: str) -> bool:
      if not re.match(URL_REGEX, url):
          logging.logger.error(f"{url} is not a valid url")
          raise InvalidURLException(f"{url} is not a valid url")
      return True
  