how to implement knn algorithm in python