code: def is_valid_endpoint(url):
      
      try:
          result = urlparse(url)
          if result.port:
              _port = int(result.port)
          return (
              all([result.scheme, result.netloc]) and
              result.scheme in ['http', 'https']
          )
      except ValueError:
          return False
docs: Just ensures the url has a scheme (http/https), and a net location (IP or domain name).
      Can make more advanced or do on-network tests if needed, but this is really just to catch obvious errors.
      >>> is_valid_endpoint("https://34.216.72.29:6206")
      True
      >>> is_valid_endpoint("blahblah")
      False
      >>> is_valid_endpoint("blah://34.216.72.29")
      False
      >>> is_valid_endpoint("http://34.216.72.29:%%%")
      False
      >>> is_valid_endpoint("http://192.168.0.2:9999")
      True