def _init_and_config_layer(
        self, atomic_layer_name, atomic_layer
    ) -> _Optional[_LayerwiseCompressionAlgorithm]:
        """
        Initializes and configures the compression algorithm for a given
        atomic layer. Returns the initialized and configured compression
        algorithm object
        """
        layer_config = self._config.get_module_config(atomic_layer_name, atomic_layer)
        if layer_config is not None:
            algo_class = _LayerwiseCompressionAlgorithm.get_class(layer_config.algorithm)
            try:
                return algo_class(atomic_layer, layer_config)
            except ValueError as error:
                _logger.info(f"Skipping compression for {atomic_layer_name}. Reason={error}")
        return None

        Initializes and configures the compression algorithm for a given
        atomic layer. Returns the initialized and configured compression
        algorithm object
        
coremltools/optimize/torch/layerwise_compression/layerwise_compressor.py