code: def valid_url(url):
      
      regex = re.compile(
          r'^(?:http)s?://'
          r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+'
          r'(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?))'
          r'(?:/?|[/?]\S+)$', re.IGNORECASE)
      if not regex.match(url):
          raise argparse.ArgumentTypeError('"{0}" is invalid url.'.format(url))
      return url
docs: Validate url.
  
      :rtype: str
      :return: url
  
      :param str url: package homepage url.