def METHOD_NAME(self, num, services):
    addrs = []
    for i in range(num):
        addr = CAddress()
        addr.time = self.mocktime + random.randrange(-100, 100)
        addr.nServices = services
        assert self.counter < 256 ** 2  # Don't allow the returned ip addresses to wrap.
        addr.ip = f"123.123.{self.counter // 256}.{self.counter % 256}"
        addr.port = self.index_to_port(self.counter)
        self.counter += 1
        addrs.append(addr)
    msg = msg_addr()
    msg.addrs = addrs
    return msg