Produces a random IPv4 address or network with a valid CIDR
        from within a given subnet.

        :param subnet: IPv4Network to choose from within
        :param network: Return a network address, and not an IP address

def _random_ipv4_address_from_subnet(self, subnet, network=False):
        """
        Produces a random IPv4 address or network with a valid CIDR
        from within a given subnet.

        :param subnet: IPv4Network to choose from within
        :param network: Return a network address, and not an IP address
        """
        address = str(
            subnet[self.generator.random.randint(
                0, subnet.num_addresses - 1,
            )],
        )

        if network:
            address += '/' + str(self.generator.random.randint(
                subnet.prefixlen,
                subnet.max_prefixlen,
            ))
            address = str(ip_network(address, strict=False))

        return address