code: def _maybe_add_condition_to_implicit_api(self, template_dict):
          
          # Short-circuit if template doesn't have any functions with implicit API events
          if not self.api_conditions.get(self.implicit_api_logical_id, {}):
              return
  
          # Add a condition to the API resource IFF all of its resource+methods are associated with serverless functions
          # containing conditions.
          implicit_api_conditions = self.api_conditions[self.implicit_api_logical_id]
          all_resource_method_conditions = set([condition
                                                for path, method_conditions in implicit_api_conditions.items()
                                                for method, condition in method_conditions.items()])
          at_least_one_resource_method = len(all_resource_method_conditions) > 0
          all_resource_methods_contain_conditions = None not in all_resource_method_conditions
          if at_least_one_resource_method and all_resource_methods_contain_conditions:
              implicit_api_resource = template_dict.get('Resources').get(self.implicit_api_logical_id)
              if len(all_resource_method_conditions) == 1:
                  condition = all_resource_method_conditions.pop()
                  implicit_api_resource['Condition'] = condition
              else:
                  # If multiple functions with multiple different conditions reference the Implicit Api, we need to
                  # aggregate those conditions in order to conditionally create the Implicit Api. See RFC:
                  # https://github.com/awslabs/serverless-application-model/issues/758
                  implicit_api_resource['Condition'] = self.implicit_api_condition
                  self._add_combined_condition_to_template(
                      template_dict, self.implicit_api_condition, all_resource_method_conditions)
docs: Decides whether to add a condition to the implicit api resource.
          :param dict template_dict: SAM template dictionary