input: Write a python function to implement a K-Nearest Neighbors classifier and predict class labels.
  assert knn_classifier(X, y, X) == y_pred
  assert knn_classifier([[1, 2], [2, 3], [3, 4]], [0, 1, 1], [[1, 2]]) == [0]
  assert knn_classifier([[5, 5], [6, 6], [7, 7]], [1, 0, 1], [[6, 6]]) == [0]
output: import numpy as np
  from collections import Counter
  
  def knn_classifier(X, y, X_test, k=3):
      def euclidean_distance(a, b):
          return np.sqrt(np.sum((np.array(a) - np.array(b))**2))
      
      def get_neighbors(training_set, labels, test_instance, k):
          distances = []
          for i in range(len(training_set)):
              dist = euclidean_distance(training_set[i], test_instance)
              distances.append((training_set[i], dist, labels[i]))
          distances.sort(key=lambda x: x[1])
          neighbors = [distances[i][2] for i in range(k)]
          return neighbors
      
      def predict_classification(neighbors):
          counter = Counter(neighbors)
          return counter.most_common(1)[0][0]
      
      y_pred = []
      for test_instance in X_test:
          neighbors = get_neighbors(X, y, test_instance, k)
          y_pred.append(predict_classification(neighbors))
      
      return y_pred