code: def template_clustering(sample_path, k_init=1, ccore=True, **kwargs):
      sample = read_sample(sample_path)
  
      gmeans_instance = gmeans(
          sample, k_init, ccore, repeat=5
      ).process()
      clusters = gmeans_instance.get_clusters()
      centers = gmeans_instance.get_centers()
  
      visualize = kwargs.get("visualize", True)
      if visualize:
          visualizer = cluster_visualizer()
          visualizer.append_clusters(clusters, sample)
          visualizer.append_cluster(
              centers, None, marker="*", markersize=10
          )
          visualizer.show()
  
      return sample, clusters
  
imports: from pyclustering.samples.definitions import SIMPLE_SAMPLES, FCPS_SAMPLES
  from pyclustering.cluster import cluster_visualizer
  from pyclustering.cluster.gmeans import gmeans
  from pyclustering.utils import read_sample
label_desc: Use image node_id 1 for calling a global function with example usage: template_clustering(sample_path, k_init, ccore) and returns: sample,  clusters