input: Write a python function to apply K-Means clustering and plot the clusters for a given dataset.
  ```python
  def apply_kmeans_and_plot(data, n_clusters):
      import pandas as pd
      from sklearn.cluster import KMeans
      import matplotlib.pyplot as plt
      
      X = data.iloc[:, :-1].values
      kmeans = KMeans(n_clusters=n_clusters, init='k-means++', random_state=0)
      pred_y = kmeans.fit_predict(X)
  
      plt.scatter(X[pred_y == 0, 0], X[pred_y == 0, 1], s=100, c='red', label='Cluster 1')
      plt.scatter(X[pred_y == 1, 0], X[pred_y == 1, 1], s=100, c='blue', label='Cluster 2')
      if n_clusters > 2:
          plt.scatter(X[pred_y == 2, 0], X[pred_y == 2, 1], s=100, c='green', label='Cluster 3')
  
      plt.scatter(kmeans.cluster_centers_[:, 0], kmeans.cluster_centers_[:, 1], s=200, c='yellow', label='Centroids')
  
      plt.legend()
      plt.show()
  
  assert apply_kmeans_and_plot(pd.read_csv('iris.csv'), 3) == None
  assert apply_kmeans_and_plot(pd.read_csv('another_dataset.csv'), 2) == None
output: for i in range(3, n_clusters):
          plt.scatter(X[pred_y == i, 0], X[pred_y == i, 1], s=100, c=np.random.rand(3,), label=f'Cluster {i+1}')
  
      plt.scatter(kmeans.cluster_centers_[:, 0], kmeans.cluster_centers_[:, 1], s=200, c='yellow', label='Centroids')
  
      plt.legend()
      plt.show()