tldextract is the best library to extract the domain name with Python.
Here is how it looks in action:
import tldextract
ext = tldextract.extract('http://forums.bbc.com')
print(ext.registered_domain)
Which would output:
bbc.co.uk

✓ Founder of Kelogs, a SaaS SEO Crawler & Log Analyzer
✓ Made for fun the app The Keyword
✓ International SEO Consultant (Freelance)
✓ Over 10 years of SEO experience
✓ Consultant to countless small and big businesses over the decade
Read more about me, myself and I.