code: def lookup_domain(self, domain, lookup_record=None, **kw):
          
          import DNS
          
          lookup_record = lookup_record.lower() if lookup_record else self._lookup_dns
          
          if lookup_record not in ('a', 'mx'):
              raise RuntimeError("Not a valid lookup_record value: " + lookup_record)
          
          if lookup_record == "a":
              request = DNS.Request(domain, **kw)
              
              try:
                  answers = request.req().answers
              
              except (DNS.Lib.PackError, UnicodeError):
                  # A part of the domain name is longer than 63.
                  return False
              
              if not answers:
                  return False
              
              result = answers[0]['data'] # This is an IP address
              
              if result in self.false_positive_ips: # pragma: no cover
                  return False
              
              return result
          
          try:
              return DNS.mxlookup(domain)
          
          except UnicodeError:
              pass
          
          return False
docs: Looks up the DNS record for *domain* and returns:
          
          * None if it does not exist,
          * The IP address if looking up the "A" record, or
          * The list of hosts in the "MX" record.
          
          The return value, if treated as a boolean, says whether a domain exists.
          
          You can pass "a" or "mx" as the *lookup_record* parameter. Otherwise,
          the *lookup_dns* parameter from the constructor is used.
          "a" means verify that the domain exists.
          "mx" means verify that the domain exists and specifies mail servers.