code: def __init__(self, loop, *, task_class, eager):
      self.suspense_count = 0
      self.task_count = 0
  
      def CountingTask(*args, eager_start=False, **kwargs):
          if not eager_start:
              self.task_count += 1
          kwargs["eager_start"] = eager_start
          return task_class(*args, **kwargs)
  
      if eager:
          factory = asyncio.create_eager_task_factory(CountingTask)
      else:
  
          def factory(loop, coro, **kwargs):
              return CountingTask(coro, loop=loop, **kwargs)
  
      loop.set_task_factory(factory)
  
imports: import asyncio
  import contextvars
  import unittest
  from unittest import mock
  from asyncio import tasks
  from test.test_asyncio import utils
  from test.support.script_helper import assert_python_ok
label_desc: Use image node_id 1 to create a new AsyncTaskCounter object  with example: obj = AsyncTaskCounter(loop)