def add_custom(self, name, input_names, output_names, custom_proto_spec=None):
        """
        Add a custom layer.
        Refer to the ``CustomLayerParams`` message in the specification (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.

        input_names: list of str
            The input blob names to this layer.

        output_names: list of str
            The output blob names from this layer.

        custom_proto_spec: CustomLayerParams
            A protobuf CustomLayerParams message. This can also be left blank and filled in later.
        """
        # custom layers require a newer specification version
        from coremltools import _MINIMUM_CUSTOM_LAYER_SPEC_VERSION

        if self.spec:
            self.spec.specificationVersion = max(
                self.spec.specificationVersion, _MINIMUM_CUSTOM_LAYER_SPEC_VERSION
            )

        spec_layer = self._add_generic_layer(name, input_names, output_names)

        spec_layer.custom.MergeFromString(b"")
        if custom_proto_spec:
            spec_layer.custom.CopyFrom(custom_proto_spec)
        return spec_layer

        Add a custom layer.
        Refer to the ``CustomLayerParams`` message in the specification (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.

        input_names: list of str
            The input blob names to this layer.

        output_names: list of str
            The output blob names from this layer.

        custom_proto_spec: CustomLayerParams
            A protobuf CustomLayerParams message. This can also be left blank and filled in later.
        
coremltools/models/neural_network/builder.py