title: How to extract top-level domain name (TLD) from URL
body: <p>how would you extract the domain name from a URL, excluding any subdomains?</p>
  
  <p>My initial simplistic attempt was:</p>
  
  <pre><code>'.'.join(urlparse.urlparse(url).netloc.split('.')[-2:])
  </code></pre>
  
  <p>This works for <a href="http://www.foo.com" rel="noreferrer">http://www.foo.com</a>, but not <a href="http://www.foo.com.au" rel="noreferrer">http://www.foo.com.au</a>.
  Is there a way to do this properly without using special knowledge about valid TLDs (Top Level Domains) or country codes (because they change).</p>
  
  <p>thanks</p>