nowwe need to build the nearest neighbor the object also needs to be trainedknn_model nearestneighbors(n_neighbors=kalgorithm='auto'fit(xdistancesindices knn_model kneighbors([test_data]nowwe can print the nearest neighbors as followsprint("\nk nearest neighbors:"for rankindex in enumerate(indices[ ][: ]start= )print(str(rankis" [index]we can visualize the nearest neighbors along with the test data pointplt figure(plt title('nearest neighbors'plt scatter( [: ] [: ]marker=' ' = color=' 'plt scatter( [indices][ ][:][: ] [indices][ ][:][: ]marker=' ' = color=' 'facecolors='none'plt scatter(test_data[ ]test_data[ ]marker=' ' = color=' 'plt show(