def get_base_domain(url):
 domain = get_domain(url)
 tld = '.'.join(domain.split('.')[(-2):])
 if (tld in ['co.uk', 'com.au', 'au.com']):
  end_chunks = domain.split('.')[(-3):]
 else:
  end_chunks = domain.split('.')[(-2):]
 base_domain = '.'.join(end_chunks)
 return base_domain

def get_base_domain ( url ) : domain = get_domain ( url ) tld = '.' . join ( domain . split ( '.' ) [ ( - 2 ) : ] ) if ( tld in [ 'co.uk' , 'com.au' , 'au.com' ] ) : end_chunks = domain . split ( '.' ) [ ( - 3 ) : ] else : end_chunks = domain . split ( '.' ) [ ( - 2 ) : ] base_domain = '.' . join ( end_chunks ) return base_domain
for example .