code: def _lookup_gai(name, rdtype, timeout=None):
      '''
      Use Python's socket interface to lookup addresses
      :param name: Name of record to search
      :param rdtype: A or AAAA
      :param timeout: ignored
      :return: [] of addresses or False if error
      '''
      try:
          sock_t = {
              'A':    socket.AF_INET,
              'AAAA': socket.AF_INET6
          }[rdtype]
      except KeyError:
          raise ValueError('Invalid DNS type {} for gai lookup'.format(rdtype))
  
      if timeout:
          log.info('Ignoring timeout on gai resolver; fix resolv.conf to do that')
  
      try:
          addresses = [sock[4][0] for sock in socket.getaddrinfo(name, None, sock_t, 0, socket.SOCK_RAW)]
          return addresses
      except socket.gaierror:
          return Falsf _lookup_gai(name, rdtype, timeout=None):
      '''
      Use Python's socket interface to lookup addresses
      :param name: Name of record to search
      :param rdtype: A or AAAA
      :param timeout: ignored
      :return: [] of addresses or False if error
      '''
      try:
          sock_t = {
              'A':    socket.AF_INET,
              'AAAA': socket.AF_INET6
          }[rdtype]
      except KeyError:
          raise ValueError('Invalid DNS type {} for gai lookup'.format(rdtype))
  
      if timeout:
          log.info('Ignoring timeout on gai resolver; fix resolv.conf to do that')
  
      try:
          addresses = [sock[4][0] for sock in socket.getaddrinfo(name, None, sock_t, 0, socket.SOCK_RAW)]
          return addresses
      except socket.gaierror:
          return False
docs: Use Python's socket interface to lookup addresses
      :param name: Name of record to search
      :param rdtype: A or AAAA
      :param timeout: ignored
      :return: [] of addresses or False if error