import socket
import tldextract
def get_ip(domain):
ip = ''
limit = 5
domain = tldextract.extract(domain).fqdn
while limit:
try:
ip = socket.gethostbyname(domain)
break
except Exception as e:
limit -= 1
return ip
print(get_ip())