class_docstr: Poll the state of the application until it reaches a terminal state; fails if the application fails.
  
  .. seealso::
      For more information on how to use this sensor, take a look at the guide:
      :ref:`howto/sensor:EmrServerlessApplicationSensor`
  
  :param application_id: application_id to check the state of
  :param target_states: a set of states to wait for, defaults to {'CREATED', 'STARTED'}
  :param aws_conn_id: aws connection to use, defaults to 'aws_default'
class_docstr_tok: ["Poll","the","state","of","the","application","until","it","reaches","a","terminal","state",";","fails","if","the","application","fails",".","..","seealso",":",":","For","more","information","on","how","to","use","this","sensor",",","take","a","look","at","the","guide",":",":","ref",":","`","howto\/sensor",":","EmrServerlessApplicationSensor","`",":","param","application_id",":","application_id","to","check","the","state","of",":","param","target_states",":","a","set","of","states","to","wait","for",",","defaults","to","{","'CREATED","'",",","'STARTED","'","}",":","param","aws_conn_id",":","aws","connection","to","use",",","defaults","to","'aws_default","'"]
docstr: Get failure message from response dictionary.
  
  :param response: response from AWS API
  :return: failure message
code: def failure_message_from_response(
      response: dict[str, Any]
  ) -> str | None:
      """
      Get failure message from response dictionary.
  
      :param response: response from AWS API
      :return: failure message
      """
      return response["application"]["stateDetails"]
  
imports: from __future__ import annotations
  from datetime import timedelta
  from functools import cached_property
  from typing import TYPE_CHECKING, Any, Iterable, Sequence
  from deprecated import deprecated
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning, AirflowSkipException
  from airflow.providers.amazon.aws.hooks.emr import EmrContainerHook, EmrHook, EmrServerlessHook
  from airflow.providers.amazon.aws.links.emr import EmrClusterLink, EmrLogsLink, get_log_uri
  from airflow.providers.amazon.aws.triggers.emr import EmrContainerTrigger, EmrStepSensorTrigger, EmrTerminateJobFlowTrigger
  from airflow.sensors.base import BaseSensorOperator
label_desc: Use image node_id 4 for calling the EmrServerlessApplicationSensor obj's underlying member method code with example usage: obj.failure_message_from_response(response) and returns: response