code: def _get_instance_state(self):
          
          instance = self._get_instance()
          statuses = instance.instance_view.statuses
  
          for status in statuses:
              if status.code.startswith('PowerState'):
                  return status.display_status
docs: Retrieve state of instance.