code: def template_clustering(
      start_centers, path, tolerance=0.25, ccore=False
  ):
      sample = read_sample(path)
      dimension = len(sample[0])
  
      metric = distance_metric(type_metric.MANHATTAN)
  
      observer = kmeans_observer()
      kmeans_instance = kmeans(
          sample,
          start_centers,
          tolerance,
          ccore,
          observer=observer,
          metric=metric,
      )
      (ticks, _) = timedcall(kmeans_instance.process)
  
      clusters = kmeans_instance.get_clusters()
      centers = kmeans_instance.get_centers()
  
      print("Sample: ", path, "\t\tExecution time: ", ticks, "\n")
  
      visualizer = cluster_visualizer_multidim()
      visualizer.append_clusters(clusters, sample)
      visualizer.show()
  
      if dimension > 3:
          kmeans_visualizer.show_clusters(
              sample, clusters, centers, start_centers
          )
          kmeans_visualizer.animate_cluster_allocation(sample, observer)
  
imports: import random
  from pyclustering.samples.definitions import SIMPLE_SAMPLES, FCPS_SAMPLES, FAMOUS_SAMPLES
  from pyclustering.cluster import cluster_visualizer_multidim
  from pyclustering.cluster.center_initializer import kmeans_plusplus_initializer
  from pyclustering.cluster.kmeans import kmeans, kmeans_observer, kmeans_visualizer
  from pyclustering.utils import read_sample
  from pyclustering.utils import timedcall
  from pyclustering.utils.metric import distance_metric, type_metric
label_desc: Use image node_id 1 for calling a global function with example usage: template_clustering(start_centers, path, tolerance, ccore) without return types