def domain_from_url(url):
ext = tldextract.extract(url)<EOL>if not ext.suffix:<EOL><INDENT>raise InvalidURLException()<EOL><DEDENT>new_url = ext.domain + "<STR_LIT:.>" + ext.suffix<EOL>return new_url<EOL>
Get root domain from url.
Will prune away query strings, url paths, protocol prefix and sub-domains
Exceptions will be raised on invalid urls