def set_op_name(
        self,
        op_name: str,
        op_config: OpCompressorConfig,
    ):
        """
        Sets the compression config at the level of constant / op instance by name.

        .. code-block:: python

            from coremltools.optimize.coreml import OpPalettizerConfig, OptimizationConfig

            config = OptimizationConfig()
            op_config = OpPalettizerConfig(mode="kmeans", nbits=2)
            config.set_op_name("conv_1", op_config)

        Note that, in order to get the name of a constant or an op instance, please refer to the ``coremltools.optimize.coreml.get_weights_metadata`` API.

        Parameters
        ----------

        op_name: str
            The name of a constant or an op instance.

        op_config: OpCompressorConfig
            Op instance level config applied to a specific constant or op with name ``op_name``.
        """
        if self._is_deprecated:
            raise ValueError("set_op_name is not exposed through the coremltools.compression_utils API.")
        self._check_op_config_type(op_config)
        self.op_name_configs[op_name] = op_config

        Sets the compression config at the level of constant / op instance by name.

        .. code-block:: python

            from coremltools.optimize.coreml import OpPalettizerConfig, OptimizationConfig

            config = OptimizationConfig()
            op_config = OpPalettizerConfig(mode="kmeans", nbits=2)
            config.set_op_name("conv_1", op_config)

        Note that, in order to get the name of a constant or an op instance, please refer to the ``coremltools.optimize.coreml.get_weights_metadata`` API.

        Parameters
        ----------

        op_name: str
            The name of a constant or an op instance.

        op_config: OpCompressorConfig
            Op instance level config applied to a specific constant or op with name ``op_name``.
        
coremltools/optimize/coreml/_config.py