code: def _check_algorithm(model):
      """Ensure the kNeighbors algorithm for the given scikit model is a supported type"""
      is_valid = False
      print_name = ""
      if model.algorithm == "brute" or model.algorithm == "kd_tree":
          is_valid = True
          print_name = model.algorithm
      elif model.algorithm == "auto" and model._fit_method == "kd_tree":
          is_valid = True
          print_name = "kd_tree"
      elif model.algorithm == "auto" and model._fit_method == "brute":
          is_valid = True
          print_name = "brute"
      if not is_valid:
          raise TypeError(
              "KNeighbors algorithm not supported for CoreML conversion: {}".format(
                  print_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 9 for calling a global function with example usage: _check_algorithm(model) without return types