code: def assert_warnings(fn, warning_msgs, regex=False):
      """Assert that each of the given warnings are emitted by fn.
  
      Deprecated.  Please use assertions.expect_warnings().
  
      """
  
      with assertions._expect_warnings(
          sa_exc.SAWarning, warning_msgs, regex=regex
      ):
          return fn()
  
file_path: sqlalchemy/lib/sqlalchemy/testing/warnings.py
imports: from __future__ import annotations
  import warnings
  from .None import assertions
  from ..None import exc
  from ..None import exc
  from ..exc import SATestSuiteWarning
  from ..util.langhelpers import _warnings_warn
label_desc: Use image node_id 3 for calling a global function with example usage: assert_warnings(fn, warning_msgs, regex) and returns: fn