input: Write a function to implement the k-means clustering algorithm in Python. The function should take in the number of clusters `k` and the dataset `data`, and return the cluster assignments for each data point and the final centroids. If the dataset is empty, the function should return an empty array for clusters and centroids.
  assert kmeans(3, np.array([[1, 2], [1, 4], [1, 0],
                             [10, 2], [10, 4], [10, 0]])) == ([1, 1, 1, 2, 2, 2], np.array([[1, 2], [10, 2]]))
  assert kmeans(0, np.array([[1, 2], [1, 4], [1, 0]])) == ([], np.array([]))
  assert kmeans(2, np.array([])) == ([], np.array([]))
output: 
  def kmeans(k, data):
      if len(data) == 0:
          return [], np.array([])
      
      centroids = data[np.random.choice(data.shape[0], k, replace=False)]
      while True:
          distances = np.linalg.norm(data[:, np.newaxis] - centroids, axis=2)
          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.tolist(), centroids
  