def add_function(
        self, model_path: str, src_function_name: str, target_function_name: str
    ) -> None:
        """
        Insert a ``src_function_name`` function from ``model_path`` as the
        ``target_function_name`` function in the multifunction descriptor.
        """
        self._add_modelpath_to_cache(model_path)

        if src_function_name not in self._modelpath_to_functions[model_path]:
            raise ValueError(f"src_function_name {src_function_name} not found in {model_path}.")

        if target_function_name in self._name_to_source_function:
            raise ValueError(f"function {target_function_name} already exist.")

        self._name_to_source_function[target_function_name] = (model_path, src_function_name)

        Insert a ``src_function_name`` function from ``model_path`` as the
        ``target_function_name`` function in the multifunction descriptor.
        
coremltools/models/utils.py