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
            )
        )
Simple wrapper to ensure the distance metric is valid for CoreML conversion
coremltools/converters/sklearn/_k_neighbors_classifier.py