code: def convert(model, input_name, output_name):
      """Convert a scikit KNeighborsClassifier to protobuf format.
  
      Parameters
      ----------
      model : KNeighborsClassifier
          A trained scikit-learn KNeighborsClassifier model.
  
      input_name: str
          Name of the input column.
  
      output_name: str
          Name of the output column.
  
      Returns
      -------
      model_spec: An object of type Model_pb.
          Protobuf representation of the model
      """
      if not (_HAS_SKLEARN):
          raise RuntimeError(
              "scikit-learn not found. scikit-learn conversion API is disabled."
          )
  
      _sklearn_util.check_expected_type(model, sklearn_class)
  
      _check_fitted(model)
      _check_algorithm(model)
      _check_weighting_scheme(model)
      _check_distance_metric(model)
  
      return _MLModel(
          _convert_k_neighbors_classifier(
              model, input_name, output_name
          )
      )
  
imports: from ..._deps import _HAS_SKLEARN
  from ...models import MLModel
  import coremltools
  from coremltools.proto import FeatureTypes_pb2
  import numpy
  import scipy
  import six
label_desc: Use image node_id 1 for calling a global function with example usage: convert(model, input_name, output_name) and returns: _MLModel