input: Write a Python function to perform KMeans clustering on user ratings and recommend the most similar book to each user.
  assert recommend_books([[5, 4, 4, 0, 2, 1, 4, 4, 5, 0], [0, 0, 0, 3, 3, 3, 0, 0, 0, 3], [4, 4, 0, 0, 4, 0, 4, 4, 4, 0]], 2) == [2, 1, 2]
  assert recommend_books([[1, 1, 1, 1, 1], [5, 5, 5, 5, 5], [3, 3, 3, 3, 3]], 2) == [0, 1, 1]
  assert recommend_books([[1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 1, 1, 1, 1]], 3) == [2, 2, 2]
output: def recommend_books(ratings, num_clusters):
      from sklearn.cluster import KMeans
      import numpy as np
      
      # Fit the KMeans model
      kmeans = KMeans(n_clusters=num_clusters, random_state=0).fit(ratings)
      
      # Predict the cluster for each user
      clusters = kmeans.predict(ratings)
      
      # Recommend a book to each user
      recommendations = []
      for i, user_ratings in enumerate(ratings):
          # Find the centroid of the cluster to which the user belongs
          centroid = kmeans.cluster_centers_[clusters[i]]
          # Find the book index with the highest rating in the centroid
          recommended_book = int(np.argmax(centroid))
          recommendations.append(recommended_book)
      
      return recommendations