def _pad_lut_for_nbits_requirements(lut: np.ndarray, nbits: int):
        """
        Make the number of palettes in lut size (second last dim) meet the 2^nbits requirement.

        This util function is needed before we add all uint sub-byte dtypes.
        """
        pad_shape = lut.shape[:-2] + (2**nbits - lut.shape[-2], lut.shape[-1])
        return np.concatenate((lut, np.zeros(pad_shape)), axis=-2)

        Make the number of palettes in lut size (second last dim) meet the 2^nbits requirement.

        This util function is needed before we add all uint sub-byte dtypes.
        
coremltools/converters/mil/mil/ops/tests/iOS18/test_compression.py