code: def template_clustering(path, amount, threshold, **kwargs):
      metric = kwargs.get(
          "metric", distance_metric(type_metric.EUCLIDEAN_SQUARE)
      )
      ccore = kwargs.get("ccore", False)
      draw = kwargs.get("draw", True)
  
      sample = read_sample(path)
  
      print("Sample: ", path)
  
      bsas_instance = bsas(
          sample, amount, threshold, ccore=ccore, metric=metric
      )
      bsas_instance.process()
  
      clusters = bsas_instance.get_clusters()
      representatives = bsas_instance.get_representatives()
  
      if draw is True:
          bsas_visualizer.show_clusters(
              sample, clusters, representatives
          )
  
file_path: pyclustering/pyclustering/cluster/examples/bsas_examples.py
imports: from pyclustering.cluster import cluster_visualizer
  from pyclustering.cluster.bsas import bsas, bsas_visualizer
  from pyclustering.samples.definitions import SIMPLE_SAMPLES
  from pyclustering.utils import read_sample
  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(path, amount, threshold) without return types