code: def template_clustering(data_path, levels, **kwargs):
      print("Sample: '%s'." % os.path.basename(data_path))
  
      density_threshold = kwargs.get("density_threshold", 0.0)
      amount_threshold = kwargs.get("amount_threshold", 0)
      data = read_sample(data_path)
  
      bang_instance = bang(
          data,
          levels,
          density_threshold=density_threshold,
          amount_threshold=amount_threshold,
      )
      bang_instance.process()
  
      clusters = bang_instance.get_clusters()
      noise = bang_instance.get_noise()
      directory = bang_instance.get_directory()
      dendrogram = bang_instance.get_dendrogram()
  
      bang_visualizer.show_blocks(directory)
      bang_visualizer.show_dendrogram(dendrogram)
      bang_visualizer.show_clusters(data, clusters, noise)
  
      if len(data[0]) == 2:
          animator = bang_animator(directory, clusters)
          animator.animate()
  
imports: import os
  from pyclustering.cluster.bang import bang, bang_visualizer, bang_animator
  from pyclustering.utils import draw_image_mask_segments, read_sample, read_image
  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(data_path, levels) without return types