code: def _check_distance_metric(model):
      """Simple wrapper to ensure the distance metric is valid for CoreML conversion"""
      is_valid = False
      if model.metric == "euclidean":
          is_valid = True
      elif model.metric == "minkowski" and model.p == 2:
          is_valid = True
  
      # There are a number of other distance metrics supported by scikit that CoreML doesn't currently support.
  
      if not is_valid:
          print_name = ""
          if _is_printable(model.metric):
              print_name = model.metric
          else:
              print_name = getattr(
                  model.metric, "__name__", repr(model.metric)
              )
          raise TypeError(
              "KNeighbors distance metric 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 11 for calling a global function with example usage: _check_distance_metric(model) without return types