def resolveHostName(self, resolutionReceiver,
                        hostName,
                        portNumber=0,
                        addressTypes=None,
                        transportSemantics='TCP'):
        """
        Initiate a hostname resolution.

        @param resolutionReceiver: an object that will receive each resolved
            address as it arrives.
        @type resolutionReceiver: L{IResolutionReceiver}

        @param hostName: see interface

        @param portNumber: see interface

        @param addressTypes: Ignored in this implementation.

        @param transportSemantics: Ignored in this implementation.

        @return: The resolution in progress.
        @rtype: L{IResolutionReceiver}
        """
        resolutionReceiver.resolutionBegan(HostResolution(hostName))
        d = self._nameResolution(hostName, portNumber)

        def cbDeliver(gairesult):
            for family, socktype, proto, canonname, sockaddr in gairesult:
                if family == socket.AF_INET6:
                    resolutionReceiver.addressResolved(
                        IPv6Address('TCP', *sockaddr))
                elif family == socket.AF_INET:
                    resolutionReceiver.addressResolved(
                        IPv4Address('TCP', *sockaddr))


        def ebLog(error):
            self._log.failure("while looking up {name} with {callable}",
                              error, name=hostName,
                              callable=self._nameResolution)

        d.addCallback(cbDeliver)
        d.addErrback(ebLog)
        d.addBoth(lambda ignored: resolutionReceiver.resolutionComplete())
        return resolutionReceiver

        Initiate a hostname resolution.

        @param resolutionReceiver: an object that will receive each resolved
            address as it arrives.
        @type resolutionReceiver: L{IResolutionReceiver}

        @param hostName: see interface

        @param portNumber: see interface

        @param addressTypes: Ignored in this implementation.

        @param transportSemantics: Ignored in this implementation.

        @return: The resolution in progress.
        @rtype: L{IResolutionReceiver}
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/endpoints.py