code: def template_segmentation(source, levels, threshold):
      data = read_image(source)
  
      bang_instance = bang(data, levels, threshold)
      bang_instance.process()
  
      clusters = bang_instance.get_clusters()
  
      draw_image_mask_segments(source, clusters)
  
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 2 for calling a global function with example usage: template_segmentation(source, levels, threshold) without return types