code: def templateLengthProcessData(
      data, start_medians, expected_cluster_length, ccore, **kwargs
  ):
      tolerance = kwargs.get("tolerance", 0.01)
      metric = kwargs.get("metric", None)
      itermax = kwargs.get("itermax", 200)
  
      if isinstance(data, str):
          sample = read_sample(data)
      else:
          sample = data
  
      kmedians_instance = kmedians(
          sample,
          start_medians,
          tolerance,
          ccore,
          metric=metric,
          itermax=itermax,
      )
      kmedians_instance.process()
  
      clusters = kmedians_instance.get_clusters()
      medians = kmedians_instance.get_medians()
      wce = kmedians_instance.get_total_wce()
  
      if itermax == 0:
          assert clusters == []
          assert start_medians == medians
          assert 0.0 == wce
          return
  
      obtained_cluster_sizes = [len(cluster) for cluster in clusters]
      assert len(sample) == sum(obtained_cluster_sizes)
      assert len(medians) == len(clusters)
  
      if expected_cluster_length is not None:
          obtained_cluster_sizes.sort()
          expected_cluster_length.sort()
          if obtained_cluster_sizes != expected_cluster_length:
              print(obtained_cluster_sizes)
          assert obtained_cluster_sizes == expected_cluster_length
  
file_path: pyclustering/pyclustering/cluster/tests/kmedians_templates.py
imports: from pyclustering.tests.assertion import assertion
  from pyclustering.cluster.kmedians import kmedians
  from pyclustering.utils import read_sample, distance_metric, type_metric
  from random import random
  import numpy
label_desc: Use image node_id 1 for calling the KmediansTestTemplates obj's underlying member method code with example usage: obj.templateLengthProcessData(data, start_medians, expected_cluster_length, ccore) without return types