<prompt> 3, 7, 2, 1, 6Nina safu ya 2-d pointi. Andika kazi ya makundi yao katika klabu K.  <response>: Here is an example function that uses the K-means clustering algorithm to cluster 2D points:pythonimport numpy as npfrom sklearn.cluster import KMeansdef cluster_pointspoints, K: Convert the input points to a 2D numpy array points_np np.arraypoints Initialize the KMeans object with the desired number of clusters kmeans KMeansn_clustersK Fit the KMeans object to the input points kmeans.fitpoints_np Return the cluster labels assigned to each point, as well as the centroids of the clusters return kmeans.labels_, kmeans.cluster_centers_To use this function, you would pass in your array of 2D points as the points argument, and specify the desired number of clusters as the K argument. The function returns two outputs: the cluster labels assigned to each point in the same order as the input array, and the centroids of the clusters. 