code: def k_means(
      X,
      n_clusters,
      init="k-means||",
      precompute_distances="auto",
      n_init=1,
      max_iter=300,
      verbose=False,
      tol=1e-4,
      random_state=None,
      copy_x=True,
      n_jobs=-1,
      algorithm="full",
      return_n_iter=False,
      oversampling_factor=2,
      init_max_iter=None,
  ):
      
      labels, inertia, centers, n_iter = _kmeans_single_lloyd(
          X,
          n_clusters,
          max_iter=max_iter,
          init=init,
          verbose=verbose,
          tol=tol,
          random_state=random_state,
          oversampling_factor=oversampling_factor,
          init_max_iter=init_max_iter,
      )
      if return_n_iter:
          return labels, centers, inertia, n_iter
      else:
          return labels, centers, inertia
docs: K-means algorithm for clustering
  
      Differences from scikit-learn:
  
      * init='k-means||'
      * oversampling_factor keyword
      * n_jobs=-1