class_docstr: Poll the state of the AWS EC2 instance until the instance reaches the target state.
  
  .. seealso::
      For more information on how to use this sensor, take a look at the guide:
      :ref:`howto/sensor:EC2InstanceStateSensor`
  
  :param target_state: target state of instance
  :param instance_id: id of the AWS EC2 instance
  :param region_name: (optional) aws region name associated with the client
  :param deferrable: if True, the sensor will run in deferrable mode
code: def execute(self, context: Context) -> Any:
      if self.deferrable:
          self.defer(
              trigger=EC2StateSensorTrigger(
                  instance_id=self.instance_id,
                  target_state=self.target_state,
                  aws_conn_id=self.aws_conn_id,
                  region_name=self.region_name,
                  poll_interval=int(self.poke_interval),
              ),
              method_name="execute_complete",
          )
      else:
          super().execute(context=context)
  
file_path: airflow/airflow/providers/amazon/aws/sensors/ec2.py
imports: from __future__ import annotations
  from functools import cached_property
  from typing import TYPE_CHECKING, Any, Sequence
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException, AirflowSkipException
  from airflow.providers.amazon.aws.hooks.ec2 import EC2Hook
  from airflow.providers.amazon.aws.triggers.ec2 import EC2StateSensorTrigger
  from airflow.sensors.base import BaseSensorOperator
label_desc: Use image node_id 2 for calling the EC2InstanceStateSensor obj's underlying member method code with example usage: obj.execute(context) without return types