def lookup_cname(domain):
 try:
  answer = dns.resolver.query(domain, 'CNAME').rrset
  ttl = answer.ttl
  result = answer.items[0].to_text()
  result = result.rstrip('.')
  return (ttl, result)
 except (DNSException, NXDOMAIN, NoAnswer):
  return (0, None)

def lookup_cname ( domain ) : try : answer = dns . resolver . query ( domain , 'CNAME' ) . rrset ttl = answer . ttl result = answer . items [ 0 ] . to_text ( ) result = result . rstrip ( '.' ) return ( ttl , result ) except ( DNSException , NXDOMAIN , NoAnswer ) : return ( 0 , None )
given a domain .