def dns_txt(self, domainname, rr='TXT'):
        "Get a list of TXT records for a domain name."
        if domainname:
          try:
              dns_list = self.dns(domainname, rr)
              if dns_list:
                  # a[0][:0] is '' for py3dns-3.0.2, otherwise b''
                  a = [a[0][:0].join(a) for a in dns_list]
                  # FIXME: workaround for error in py3dns-3.0.2
                  if isinstance(a[0],bytes):
                      return a
                  return [s.encode('utf-8') for s in a]
          # FIXME: workaround for error in py3dns-3.0.2
          except UnicodeError:
              raise PermError('Non-ascii characters found in %s record for %s'
                 %(rr,domainname))
        return []
Get a list of TXT records for a domain name.
python/spf.py