input: Write a function to implement the K-Means Algorithm.
  assert np.array_equal(k_means_clustering([[0, 0], [4, 5], [6, 2], [-2, 4]], 2), np.array([0, 1, 1, 0]))
  assert np.array_equal(k_means_clustering([[1, 2], [1, 4], [3, 4], [5, 6], [8, 8]], 2), np.array([0, 0, 0, 1, 1]))
  assert np.array_equal(k_means_clustering([[1, 1], [2, 2], [3, 3], [6, 6], [7, 7]], 3), np.array([0, 0, 0, 1, 1]))
output: def k_means_clustering(data, k):
      import numpy as np
      from scipy.spatial.distance import cdist
  
      data = np.array(data)
      centroids = data[np.random.choice(data.shape[0], k, replace=False)]
  
      while True:
          distances = cdist(data, centroids, 'euclidean')
          clusters = np.argmin(distances, axis=1)
          
          new_centroids = np.array([data[clusters == i].mean(axis=0) for i in range(k)])
          
          if np.all(centroids == new_centroids):
              break
          
          centroids = new_centroids
          
      return clusters