def set_op_type(
        self,
        op_type: str,
        op_config: OpCompressorConfig,
    ):
        """
        Sets the compression config at the level of op type.

        .. code-block:: python

            from coremltools.optimize.coreml import OpPalettizerConfig, OptimizationConfig

            config = OptimizationConfig()
            conv_config = OpPalettizerConfig(mode="kmeans", nbits=2)
            config.set_op_type("conv", conv_config)

        Parameters
        ----------

        op_type: str
            The type of an op. For instance, ``"conv", "linear"``.

        op_config: OpCompressorConfig
            Op type level config applied to a specific op class ``op_type``.
        """
        if self._is_deprecated:
            raise ValueError("set_op_type is not exposed through the coremltools.compression_utils API.")
        self._check_op_config_type(op_config)
        if op_config is not None:
            op_config._validate_op_type(op_type)
        self.op_type_configs[op_type] = op_config

        Sets the compression config at the level of op type.

        .. code-block:: python

            from coremltools.optimize.coreml import OpPalettizerConfig, OptimizationConfig

            config = OptimizationConfig()
            conv_config = OpPalettizerConfig(mode="kmeans", nbits=2)
            config.set_op_type("conv", conv_config)

        Parameters
        ----------

        op_type: str
            The type of an op. For instance, ``"conv", "linear"``.

        op_config: OpCompressorConfig
            Op type level config applied to a specific op class ``op_type``.
        
coremltools/optimize/coreml/_config.py