input: import numpy as np
  
  def kmeans(k, data):
      """
      Perform k-means clustering on data
      >>> kmeans(2, np.array([[1.0, 1.0], [2.0, 2.0], [10.0, 10.0], [11.0, 11.0]]))
      (array([0., 0., 1., 1.]), array([[ 1.5,  1.5],
         [10.5, 10.5]]))
      """
output:     centroids = data[np.random.choice(data.shape[0], k, replace=False)]
      while True:
          distances = np.linalg.norm(data[:, np.newaxis] - centroids, axis=2)
          labels = np.argmin(distances, axis=1)
          new_centroids = np.array([data[labels == i].mean(axis=0) for i in range(k)])
          if np.all(centroids == new_centroids):
              break
          centroids = new_centroids
      return labels, centroids