code: def url_to_host_port(url, port=None):
      
      if not url.startswith('http://') and not url.startswith('https://'):
          url = 'http://' + url
  
      if not port:
          port = RPC_SERVER_PORT
  
      urlinfo = urllib2.urlparse.urlparse(url)
      hostport = urlinfo.netloc
  
      parts = hostport.split('@')
      if len(parts) > 2:
          return None, None
  
      if len(parts) == 2:
          hostport = parts[1]
  
      parts = hostport.split(':')
      if len(parts) > 2:
          return None, None
  
      if len(parts) == 2:
          try:
              port = int(parts[1])
              assert 0 < port and port < 65535, 'Invalid port'
          except TypeError:
              return None, None
  
      return parts[0], port
docs: Given a URL, turn it into (host, port) for a blockstack server.
      Return (None, None) on invalid URL