code: def _check_weighting_scheme(model):
      """Simple wrapper to ensure the weighting scheme is valid for CoreML conversion"""
      is_valid = False
      if model.weights == "uniform":
          is_valid = True
  
      # Other cases CoreML doesn't support include weighting by distance or a user-provided 'callable' object.
  
      if not is_valid:
          print_name = ""
          if _is_printable(model.weights):
              print_name = model.weights
          else:
              print_name = getattr(
                  model.weights, "__name__", repr(model.weights)
              )
          raise TypeError(
              "KNeighbors weight function 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 10 for calling a global function with example usage: _check_weighting_scheme(model) without return types