code: def get_ips(host, port):
      
      ips = set()
  
      for af_type in (socket.AF_INET, socket.AF_INET6):
          try:
              records = socket.getaddrinfo(host, port, af_type, socket.SOCK_STREAM)
              ips.update(rec[4][0] for rec in records)
          except socket.gaierror as ex:
              pass
  
      return ips
docs: lookup all IPs (v4 and v6)