title: Removing subdomains from string domain name
body: <p>So I have written a small function to remove sub-domains (<strong>if any</strong>) from string of input domains:</p>
  
  <pre><code>def rm(text):
      print(text.replace(text, '.'.join(text.split('.')[-2:])), end="")
      print("\n")
  
  if __name__ == "__main__":
      rm("me.apple.com")
      rm("not.me.apple.com")
      rm("really.not.me.apple.com")
      # problem here
      rm("bbc.co.uk")
  </code></pre>
  
  <p>It all but works fine until you have <code>.something.something</code> tld., like <code>.co.uk</code> or <code>.co.in</code>. </p>
  
  <p>So my output is:</p>
  
  <pre><code>apple.com
  apple.com
  apple.com
  --&gt; co.uk
  </code></pre>
  
  <p>Where it should have been,</p>
  
  <pre><code>apple.com
  apple.com
  apple.com
  bbc.co.uk
  </code></pre>
  
  <p>How do I fix/create the function in an elegant way instead of checking for all possible double tlds? 
  <strong>Edit:</strong> I will have to check millions of domains, if that matters. So what I would do is to pass a domain to my function and get a clean, subdomain free domain.</p>