def txt_records_for_name(name):
 if (not DNS_AVAILABLE):
  raise errors.DependencyError('{0} is required to use this function'.format(DNS_REQUIREMENT))
 try:
  dns_response = dns.resolver.query(name, 'TXT')
 except dns.resolver.NXDOMAIN as error:
  return []
 except dns.exception.DNSException as error:
  logger.error('Error resolving %s: %s', name, str(error))
  return []
 return [txt_rec.decode('utf-8') for rdata in dns_response for txt_rec in rdata.strings]

def txt_records_for_name ( name ) : if ( not DNS_AVAILABLE ) : raise errors . DependencyError ( '{0} is required to use this function' . format ( DNS_REQUIREMENT ) ) try : dns_response = dns . resolver . query ( name , 'TXT' ) except dns . resolver . NXDOMAIN as error : return [ ] except dns . exception . DNSException as error : logger . error ( 'Error resolving %s: %s' , name , str ( error ) ) return [ ] return [ txt_rec . decode ( 'utf-8' ) for rdata in dns_response for txt_rec in rdata . strings ]
resolve the name and return the txt records .