code: def url_protocol(url, port=None):
      
      if not url.startswith('http://') and not url.startswith('https://'):
          return None
  
      urlinfo = urllib2.urlparse.urlparse(url)
      assert urlinfo.scheme in ['http', 'https'], 'Invalid URL scheme in {}'.format(url)
      return urlinfo.scheme
docs: Get the protocol to use for a URL.
      return 'http' or 'https' or None