code: def template_clustering(number_clusters, path, links):
      sample = read_sample(path)
  
      clusters_centroid_link = None
      clusters_single_link = None
      clusters_complete_link = None
      clusters_average_link = None
  
      visualizer = cluster_visualizer(len(links), len(links))
      index_canvas = 0
  
      if type_link.CENTROID_LINK in links:
          agglomerative_centroid_link = agglomerative(
              sample, number_clusters, type_link.CENTROID_LINK, True
          )
  
          (ticks, result) = timedcall(
              agglomerative_centroid_link.process
          )
          clusters_centroid_link = (
              agglomerative_centroid_link.get_clusters()
          )
  
          visualizer.append_clusters(
              clusters_centroid_link, sample, index_canvas
          )
          visualizer.set_canvas_title("Link: Centroid", index_canvas)
          index_canvas += 1
  
          print(
              "Sample: ",
              path,
              "Link: Centroid",
              "\tExecution time: ",
              ticks,
              "\n",
          )
  
      if type_link.SINGLE_LINK in links:
          agglomerative_simple_link = agglomerative(
              sample, number_clusters, type_link.SINGLE_LINK
          )
  
          (ticks, result) = timedcall(agglomerative_simple_link.process)
          clusters_single_link = (
              agglomerative_simple_link.get_clusters()
          )
  
          visualizer.append_clusters(
              clusters_single_link, sample, index_canvas
          )
          visualizer.set_canvas_title("Link: Single", index_canvas)
          index_canvas += 1
  
          print(
              "Sample: ",
              path,
              "Link: Single",
              "\tExecution time: ",
              ticks,
              "\n",
          )
  
      if type_link.COMPLETE_LINK in links:
          agglomerative_complete_link = agglomerative(
              sample, number_clusters, type_link.COMPLETE_LINK
          )
  
          (ticks, result) = timedcall(
              agglomerative_complete_link.process
          )
          clusters_complete_link = (
              agglomerative_complete_link.get_clusters()
          )
  
          visualizer.append_clusters(
              clusters_complete_link, sample, index_canvas
          )
          visualizer.set_canvas_title("Link: Complete", index_canvas)
          index_canvas += 1
  
          print(
              "Sample: ",
              path,
              "Link: Complete",
              "\tExecution time: ",
              ticks,
              "\n",
          )
  
      if type_link.AVERAGE_LINK in links:
          agglomerative_average_link = agglomerative(
              sample, number_clusters, type_link.AVERAGE_LINK
          )
  
          (ticks, result) = timedcall(
              agglomerative_average_link.process
          )
          clusters_average_link = (
              agglomerative_average_link.get_clusters()
          )
  
          visualizer.append_clusters(
              clusters_average_link, sample, index_canvas
          )
          visualizer.set_canvas_title("Link: Average", index_canvas)
          index_canvas += 1
  
          print(
              "Sample: ",
              path,
              "Link: Average",
              "\tExecution time: ",
              ticks,
              "\n",
          )
  
      visualizer.show()
  
imports: from pyclustering.cluster import cluster_visualizer
  from pyclustering.cluster.agglomerative import agglomerative, type_link
  from pyclustering.utils import read_sample
  from pyclustering.utils import timedcall
  from pyclustering.samples.definitions import SIMPLE_SAMPLES, FCPS_SAMPLES
label_desc: Use image node_id 1 for calling a global function with example usage: template_clustering(number_clusters, path, links) without return types