code: def on_after_transform_template(self, template):
          
          if self._wait_for_template_active_status and not self._validate_only:
              start_time = time()
              while (time() - start_time) < self.TEMPLATE_WAIT_TIMEOUT_SECONDS:
                  temp = self._in_progress_templates
                  self._in_progress_templates = []
  
                  # Check each resource to make sure it's active
                  for application_id, template_id in temp:
                      get_cfn_template = (lambda application_id, template_id:
                                          self._sar_client.get_cloud_formation_template(
                                              ApplicationId=self._sanitize_sar_str_param(application_id),
                                              TemplateId=self._sanitize_sar_str_param(template_id)))
                      response = self._sar_service_call(get_cfn_template, application_id, application_id, template_id)
                      self._handle_get_cfn_template_response(response, application_id, template_id)
  
                  # Don't sleep if there are no more templates with PREPARING status
                  if len(self._in_progress_templates) == 0:
                      break
  
                  # Sleep a little so we don't spam service calls
                  sleep(self.SLEEP_TIME_SECONDS)
  
              # Not all templates reached active status
              if len(self._in_progress_templates) != 0:
                  application_ids = [items[0] for items in self._in_progress_templates]
                  raise InvalidResourceException(application_ids, "Timed out waiting for nested stack templates "
                                                                  "to reach ACTIVE status.")
docs: Hook method that gets called after the template is processed
  
          Go through all the stored applications and make sure they're all ACTIVE.
  
          :param dict template: Dictionary of the SAM template
          :return: Nothing