class_docstr: Available events for :class:`_pool.Pool`.
  
  The methods here define the name of an event as well
  as the names of members that are passed to listener
  functions.
  
  e.g.::
  
      from sqlalchemy import event
  
      def my_on_checkout(dbapi_conn, connection_rec, connection_proxy):
          "handle an on checkout event"
  
      event.listen(Pool, 'checkout', my_on_checkout)
  
  In addition to accepting the :class:`_pool.Pool` class and
  :class:`_pool.Pool` instances, :class:`_events.PoolEvents` also accepts
  :class:`_engine.Engine` objects and the :class:`_engine.Engine` class as
  targets, which will be resolved to the ``.pool`` attribute of the
  given engine or the :class:`_pool.Pool` class::
  
      engine = create_engine("postgresql+psycopg2://scott:tiger@localhost/test")
  
      # will associate with engine.pool
      event.listen(engine, 'checkout', my_on_checkout)
class_docstr_tok: ["Available","events","for",":","class",":","`","_pool.Pool","`",".","The","methods","here","define","the","name","of","an","event","as","well","as","the","names","of","members","that","are","passed","to","listener","functions",".","e.g",".",":",":","from","sqlalchemy","import","event","def","my_on_checkout","(","dbapi_conn",",","connection_rec",",","connection_proxy",")",":","``","handle","an","on","checkout","event","''","event.listen","(","Pool",",","'checkout","'",",","my_on_checkout",")","In","addition","to","accepting","the",":","class",":","`","_pool.Pool","`","class","and",":","class",":","`","_pool.Pool","`","instances",",",":","class",":","`","_events.PoolEvents","`","also","accepts",":","class",":","`","_engine.Engine","`","objects","and","the",":","class",":","`","_engine.Engine","`","class","as","targets",",","which","will","be","resolved","to","the","``",".pool","``","attribute","of","the","given","engine","or","the",":","class",":","`","_pool.Pool","`","class",":",":","engine","=","create_engine","(","``","postgresql+psycopg2",":","\/\/scott",":","tiger","@","localhost\/test","''",")","#","will","associate","with","engine.pool","event.listen","(","engine",",","'checkout","'",",","my_on_checkout",")"]
code: def _accept_with(
      cls,
      target: Union[Pool, Type[Pool], Engine, Type[Engine]],
      identifier: str,
  ) -> Optional[Union[Pool, Type[Pool]]]:
      if not typing.TYPE_CHECKING:
          Engine = util.preloaded.engine.Engine
  
      if isinstance(target, type):
          if issubclass(target, Engine):
              return Pool
          else:
              assert issubclass(target, Pool)
              return target
      elif isinstance(target, Engine):
          return target.pool
      elif isinstance(target, Pool):
          return target
      elif hasattr(target, "_no_async_engine_events"):
          target._no_async_engine_events()
      else:
          return None
  
imports: from __future__ import annotations
  import typing
  from typing import Any
  from typing import Optional
  from typing import Type
  from typing import Union
  from .base import ConnectionPoolEntry
  from .base import Pool
  from .base import PoolProxiedConnection
  from .base import PoolResetState
  from ..None import event
  from ..None import util
label_desc: Use image node_id 1 for calling the PoolEvents obj's underlying member method code with example usage: obj._accept_with(cls, target, identifier) and returns: Pool, target, target, target, None