def ipv4(
        self,
        network: bool = False,
        address_class: Optional[str] = None,
        private: Optional[str] = None,
    ) -> str:
        """
        Returns a random IPv4 address or network with a valid CIDR.

        :param network: Network address
        :param address_class: IPv4 address class (a, b, or c)
        :param private: Public or private
        :returns: IPv4
        """
        if private is True:
            return self.ipv4_private(address_class=address_class, network=network)
        elif private is False:
            return self.ipv4_public(address_class=address_class, network=network)
        else:
            all_networks, weights = self._get_all_networks_and_weights(address_class=address_class)
            return self._random_ipv4_address_from_subnets(all_networks, weights=weights, network=network)

        Returns a random IPv4 address or network with a valid CIDR.

        :param network: Network address
        :param address_class: IPv4 address class (a, b, or c)
        :param private: Public or private
        :returns: IPv4
        
faker/providers/internet/__init__.py