code: def _log_notices(self, cursor):
      # check also that notices is an iterable, after it's already
      # established that we will be iterating through it.  This is to get
      # around test suites such as SQLAlchemy's using a Mock object for
      # cursor
      if not cursor.connection.notices or not isinstance(
          cursor.connection.notices, collections_abc.Iterable
      ):
          return
  
      for notice in cursor.connection.notices:
          # NOTICE messages have a
          # newline character at the end
          logger.info(notice.rstrip())
  
      cursor.connection.notices[:] = []
  
imports: from __future__ import annotations
  import collections.abc
  import logging
  import re
  from typing import cast
  from .None import ranges
  from ._psycopg_common import _PGDialect_common_psycopg
  from ._psycopg_common import _PGExecutionContext_common_psycopg
  from .base import PGIdentifierPreparer
  from .json import JSON
  from .json import JSONB
  from ...None import types
  from ...None import util
  from ...util import FastIntFlag
  from ...util import parse_user_argument_for_enum
label_desc: Use image node_id 2 for calling the PGExecutionContext_psycopg2 obj's underlying member method code with example usage: obj._log_notices(cursor) without return types