def resolveHostName(self, resolutionReceiver, hostName, portNumber=0,
                        addressTypes=None, transportSemantics='TCP'):
        """
        See L{IHostnameResolver.resolveHostName}

        @param resolutionReceiver: see interface

        @param hostName: see interface

        @param portNumber: see interface

        @param addressTypes: see interface

        @param transportSemantics: see interface

        @return: see interface
        """
        # If it's str, we need to make sure that it's just ASCII.
        try:
            hostName = hostName.encode('ascii')
        except UnicodeEncodeError:
            # If it's not just ASCII, IDNA it. We don't want to give a Unicode
            # string with non-ASCII in it to Python 3, as if anyone passes that
            # to a Python 3 stdlib function, it will probably use the wrong
            # IDNA version and break absolutely everything
            hostName = _idnaBytes(hostName)

        # Make sure it's passed down as a native str, to maintain the interface
        hostName = nativeString(hostName)

        resolution = HostResolution(hostName)
        resolutionReceiver.resolutionBegan(resolution)
        onAddress = self._simpleResolver.getHostByName(hostName)
        def addressReceived(address):
            resolutionReceiver.addressResolved(IPv4Address('TCP', address,
                                                           portNumber))
        def errorReceived(error):
            if not error.check(DNSLookupError):
                self._log.failure("while looking up {name} with {resolver}",
                                  error, name=hostName,
                                  resolver=self._simpleResolver)
        onAddress.addCallbacks(addressReceived, errorReceived)
        def finish(result):
            resolutionReceiver.resolutionComplete()
        onAddress.addCallback(finish)
        return resolution

        See L{IHostnameResolver.resolveHostName}

        @param resolutionReceiver: see interface

        @param hostName: see interface

        @param portNumber: see interface

        @param addressTypes: see interface

        @param transportSemantics: see interface

        @return: see interface
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_resolver.py