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
            )
        )
Ensure the kNeighbors algorithm for the given scikit model is a supported type
coremltools/converters/sklearn/_k_neighbors_classifier.py