code: def _get_wildcard_address(self, port):
      
      fallback_address = '::' if socket.has_ipv6 else '0.0.0.0'
      if hasattr(socket, 'AI_PASSIVE'):
        try:
          addrinfos = socket.getaddrinfo(None, port, socket.AF_UNSPEC,
                                         socket.SOCK_STREAM, socket.IPPROTO_TCP,
                                         socket.AI_PASSIVE)
        except socket.gaierror as e:
          logger.warn('Failed to auto-detect wildcard address, assuming %s: %s',
                      fallback_address, str(e))
          return fallback_address
        addrs_by_family = defaultdict(list)
        for family, _, _, _, sockaddr in addrinfos:
          # Format of the "sockaddr" socket address varies by address family,
          # but [0] is always the IP address portion.
          addrs_by_family[family].append(sockaddr[0])
        if hasattr(socket, 'AF_INET6') and addrs_by_family[socket.AF_INET6]:
          return addrs_by_family[socket.AF_INET6][0]
        if hasattr(socket, 'AF_INET') and addrs_by_family[socket.AF_INET]:
          return addrs_by_family[socket.AF_INET][0]
      logger.warn('Failed to auto-detect wildcard address, assuming %s',
                  fallback_address)
      return fallback_address
docs: Returns a wildcard address for the port in question.
  
      This will attempt to follow the best practice of calling getaddrinfo() with
      a null host and AI_PASSIVE to request a server-side socket wildcard address.
      If that succeeds, this returns the first IPv6 address found, or if none,
      then returns the first IPv4 address. If that fails, then this returns the
      hardcoded address "::" if socket.has_ipv6 is True, else "0.0.0.0".