code: def test_delete_consumergroups(
      kafka_admin_client, kafka_consumer_factory, send_messages
  ):
      random_group_id = "test-group-" + random_string(6)
      group1 = random_group_id + "_1"
      group2 = random_group_id + "_2"
      group3 = random_group_id + "_3"
  
      send_messages(range(0, 100), partition=0)
      consumer1 = kafka_consumer_factory(group_id=group1)
      next(consumer1)
      consumer1.close()
  
      consumer2 = kafka_consumer_factory(group_id=group2)
      next(consumer2)
      consumer2.close()
  
      consumer3 = kafka_consumer_factory(group_id=group3)
      next(consumer3)
      consumer3.close()
  
      consumergroups = {
          group_id
          for group_id, _ in kafka_admin_client.list_consumer_groups()
      }
      assert group1 in consumergroups
      assert group2 in consumergroups
      assert group3 in consumergroups
  
      delete_results = {
          group_id: error
          for group_id, error in kafka_admin_client.delete_consumer_groups(
              [group1, group2]
          )
      }
      assert delete_results[group1] == NoError
      assert delete_results[group2] == NoError
      assert group3 not in delete_results
  
      consumergroups = {
          group_id
          for group_id, _ in kafka_admin_client.list_consumer_groups()
      }
      assert group1 not in consumergroups
      assert group2 not in consumergroups
      assert group3 in consumergroups
  
file_path: kafka-python/test/test_admin_integration.py
imports: import pytest
  from logging import info
  from test.testutil import env_kafka_version, random_string
  from threading import Event, Thread
  from time import time, sleep
  from kafka.admin import ACLFilter, ACLOperation, ACLPermissionType, ResourcePattern, ResourceType, ACL, ConfigResource, ConfigResourceType
  from kafka.errors import NoError, GroupCoordinatorNotAvailableError, NonEmptyGroupError, GroupIdNotFoundError
label_desc: Use image node_id 8 for calling a global function with example usage: test_delete_consumergroups(kafka_admin_client, kafka_consumer_factory, send_messages) without return types