code: def test_maybe_auto_commit_offsets_sync(
      mocker,
      api_version,
      group_id,
      enable,
      error,
      has_auto_commit,
      commit_offsets,
      warn,
      exc,
  ):
      mock_warn = mocker.patch("kafka.coordinator.consumer.log.warning")
      mock_exc = mocker.patch(
          "kafka.coordinator.consumer.log.exception"
      )
      client = KafkaClient(api_version=api_version)
      coordinator = ConsumerCoordinator(
          client,
          SubscriptionState(),
          Metrics(),
          api_version=api_version,
          session_timeout_ms=30000,
          max_poll_interval_ms=30000,
          enable_auto_commit=enable,
          group_id=group_id,
      )
      commit_sync = mocker.patch.object(
          coordinator, "commit_offsets_sync", side_effect=error
      )
      if has_auto_commit:
          assert coordinator.next_auto_commit_deadline is not None
      else:
          assert coordinator.next_auto_commit_deadline is None
  
      assert coordinator._maybe_auto_commit_offsets_sync() is None
  
      if has_auto_commit:
          assert coordinator.next_auto_commit_deadline is not None
  
      assert commit_sync.call_count == (1 if commit_offsets else 0)
      assert mock_warn.call_count == (1 if warn else 0)
      assert mock_exc.call_count == (1 if exc else 0)
  
imports: from __future__ import absolute_import
  import time
  import pytest
  from kafka.client_async import KafkaClient
  from kafka.consumer.subscription_state import SubscriptionState, ConsumerRebalanceListener
  from kafka.coordinator.assignors.range import RangePartitionAssignor
  from kafka.coordinator.assignors.roundrobin import RoundRobinPartitionAssignor
  from kafka.coordinator.assignors.sticky.sticky_assignor import StickyPartitionAssignor
  from kafka.coordinator.base import Generation, MemberState, HeartbeatThread
  from kafka.coordinator.consumer import ConsumerCoordinator
  from kafka.coordinator.protocol import ConsumerProtocolMemberMetadata, ConsumerProtocolMemberAssignment
  import kafka.errors
  from kafka.future import Future
  from kafka.metrics import Metrics
  from kafka.protocol.commit import OffsetCommitRequest, OffsetCommitResponse, OffsetFetchRequest, OffsetFetchResponse
  from kafka.protocol.metadata import MetadataResponse
  from kafka.structs import OffsetAndMetadata, TopicPartition
  from kafka.util import WeakMethod
label_desc: Use image node_id 22 for calling a global function with example usage: test_maybe_auto_commit_offsets_sync(mocker, api_version, group_id, enable, error, has_auto_commit, commit_offsets, warn, exc) without return types