'Resolve a DNS hostname.
Resolves the given DNS hostname into an IP address, and returns it
in the dot-separated format as a string.
Args:
host: hostname to resolve.'

@_js_slot(str)
def dnsResolve(self, host):

    ips = QHostInfo.fromName(host)
    if ((ips.error() != QHostInfo.NoError) or (not ips.addresses())):
        err_f = 'Failed    to    resolve    host    during    PAC    evaluation:    {}'
        log.network.info(err_f.format(host))
        return QJSValue(QJSValue.NullValue)
    else:
        return ips.addresses()[0].toString()
