code: def templateAllocateRequestedClusterAmount(
      data, amount_clusters, initial_medoids, ccore_flag
  ):
      if initial_medoids is None:
          initial_medoids = []
          for _ in range(amount_clusters):
              index_point = randint(0, len(data) - 1)
              while index_point in initial_medoids:
                  index_point = randint(0, len(data) - 1)
  
              initial_medoids.append(index_point)
  
      kmedoids_instance = kmedoids(
          data, initial_medoids, 0.025, ccore=ccore_flag
      )
      kmedoids_instance.process()
      clusters = kmedoids_instance.get_clusters()
  
      assertion.eq(len(clusters), amount_clusters)
      amount_objects = 0
      for cluster in clusters:
          amount_objects += len(cluster)
  
      assertion.eq(len(data), amount_objects)
  
file_path: pyclustering/pyclustering/cluster/tests/kmedoids_templates.py
imports: import math
  import numpy
  from pyclustering.tests.assertion import assertion
  from pyclustering.cluster.kmedoids import kmedoids, build
  from pyclustering.cluster.center_initializer import kmeans_plusplus_initializer
  from pyclustering.samples import answer_reader
  from pyclustering.utils import read_sample, calculate_distance_matrix
  from pyclustering.utils.metric import distance_metric, type_metric
  from random import random, randint
label_desc: Use image node_id 4 for calling the kmedoids_test_template obj's underlying member method code with example usage: obj.templateAllocateRequestedClusterAmount(data, amount_clusters, initial_medoids, ccore_flag) without return types