code: def test_wait_for_state(self, rds_hook: RdsHook):
      def poke():
          return "foo"
  
      with pytest.raises(
          AirflowException, match="Max attempts exceeded"
      ):
          with patch(
              "airflow.providers.amazon.aws.hooks.rds.time.sleep"
          ) as mock:
              rds_hook._wait_for_state(
                  poke,
                  target_state="bar",
                  check_interval=0,
                  max_attempts=2,
              )
      # This next line should exist outside of the pytest.raises() context manager or else it won't
      # get executed
      mock.assert_called_once_with(0)
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Generator
  from unittest.mock import patch
  import pytest
  from moto import mock_rds
  from airflow.exceptions import AirflowException, AirflowNotFoundException
  from airflow.providers.amazon.aws.hooks.rds import RdsHook
label_desc: Use image node_id 22 for calling the TestRdsHook obj's underlying member method code with example usage: obj.test_wait_for_state(rds_hook) and returns: str