def peek(self):
    if (len(self.address_deque) == 0):
        return None
    while (len(self.address_deque) > 0):
        self._logger.debug('Peek at address list: {0}'.format(list(self.address_deque)))
        entry = self.address_deque[0]
        if entry.resolved:
            return entry.data
        else:
            self.pop()
            (host, port) = (entry.host, entry.data)
            try:
                resolved_hosts = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)
            except Exception as e:
                self._logger.warning('Error resolving host "{0}" on port {1}: {2}'.format(host, port, e))
                continue
            random.shuffle(resolved_hosts)
            for addrinfo in resolved_hosts:
                if (addrinfo[0] in (socket.AF_INET, socket.AF_INET6)):
                    self.address_deque.appendleft(_AddressEntry(host=host, resolved=True, data=addrinfo))
    return None
def peek(self):
    if (len(self.address_deque) == 0):
        return None
    while (len(self.address_deque) > 0):
        self._logger.debug('Peek at address list: {0}'.format(list(self.address_deque)))
        entry = self.address_deque[0]
        if entry.resolved:
            return entry.data
        else:
            self.pop()
            (host, port) = (entry.host, entry.data)
            try:
                resolved_hosts = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)
            except Exception as e:
                self._logger.warning('Error resolving host "{0}" on port {1}: {2}'.format(host, port, e))
                continue
            random.shuffle(resolved_hosts)
            for addrinfo in resolved_hosts:
                if (addrinfo[0] in (socket.AF_INET, socket.AF_INET6)):
                    self.address_deque.appendleft(_AddressEntry(host=host, resolved=True, data=addrinfo))
    return None