code: def create_collections_and_insert_data(
      prefix, flush=True, count=3000, collection_cnt=11
  ):
      import random
  
      dim = 128
      nb = count // 10
      default_fields = [
          FieldSchema(
              name="count", dtype=DataType.INT64, is_primary=True
          ),
          FieldSchema(name="random_value", dtype=DataType.DOUBLE),
          FieldSchema(
              name="float_vector", dtype=DataType.FLOAT_VECTOR, dim=dim
          ),
      ]
      default_schema = CollectionSchema(
          fields=default_fields, description="test collection"
      )
      for index_name in all_index_types[:collection_cnt]:
          logger.info("\nCreate collection...")
          col_name = prefix + index_name
          collection = Collection(name=col_name, schema=default_schema)
          logger.info(f"collection name: {col_name}")
          logger.info(f"begin insert, count: {count} nb: {nb}")
          times = int(count // nb)
          total_time = 0.0
          vectors = [
              [random.random() for _ in range(dim)]
              for _ in range(count)
          ]
          for j in range(times):
              start_time = time.time()
              collection.insert(
                  [
                      [i for i in range(nb * j, nb * j + nb)],
                      [
                          float(random.randrange(-20, -10))
                          for _ in range(nb)
                      ],
                      vectors[nb * j : nb * j + nb],
                  ]
              )
              end_time = time.time()
              logger.info(
                  f"[{j+1}/{times}] insert {nb} data, time: {end_time - start_time:.4f}"
              )
              total_time += end_time - start_time
              if j <= times - 3:
                  collection.flush()
                  collection.num_entities
              if j == times - 3:
                  collection.compact()
  
          logger.info(f"end insert, time: {total_time:.4f}")
          if flush:
              logger.info("Get collection entities")
              start_time = time.time()
              if pymilvus_version >= "2.2.0":
                  collection.flush()
              else:
                  collection.num_entities
              logger.info(
                  f"collection entities: {collection.num_entities}"
              )
              end_time = time.time()
              logger.info(
                  "Get collection entities time = %.4fs"
                  % (end_time - start_time)
              )
      logger.info("\nList collections...")
      logger.info(get_collections(prefix))
  
file_path: milvus/tests/python_client/deploy/scripts/utils.py
imports: import sys
  import copy
  import time
  from loguru import logger
  import pymilvus
  from pymilvus import FieldSchema, CollectionSchema, DataType, Collection, list_collections
label_desc: Use image node_id 4 for calling a global function with example usage: create_collections_and_insert_data(prefix, flush, count, collection_cnt) without return types