def _maybe_add_conditions_to_implicit_api_paths(self, template):
for api_id, api in template.iterate(SamResourceType.Api.value):<EOL><INDENT>if not api.properties.get('<STR_LIT>'):<EOL><INDENT>continue<EOL><DEDENT>swagger = api.properties.get("<STR_LIT>")<EOL>editor = SwaggerEditor(swagger)<EOL>for path in editor.iter_on_path():<EOL><INDENT>all_method_conditions = set(<EOL>[condition for method, condition in self.api_conditions[api_id][path].items()]<EOL>)<EOL>at_least_one_method = len(all_method_conditions) > <NUM_LIT:0><EOL>all_methods_contain_conditions = None not in all_method_conditions<EOL>if at_least_one_method and all_methods_contain_conditions:<EOL><INDENT>if len(all_method_conditions) == <NUM_LIT:1>:<EOL><INDENT>editor.make_path_conditional(path, all_method_conditions.pop())<EOL><DEDENT>else:<EOL><INDENT>path_condition_name = self._path_condition_name(api_id, path)<EOL>self._add_combined_condition_to_template(<EOL>template.template_dict, path_condition_name, all_method_conditions)<EOL>editor.make_path_conditional(path, path_condition_name)<EOL><DEDENT><DEDENT><DEDENT>api.properties["<STR_LIT>"] = editor.swagger<EOL>template.set(api_id, api)<EOL><DEDENT>
Add conditions to implicit API paths if necessary.

Implicit API resource methods are constructed from API events on individual serverless functions within the SAM
template. Since serverless functions can have conditions on them, it's possible to have a case where all methods
under a resource path have conditions on them. If all of these conditions evaluate to false, the entire resource
path should not be defined either. This method checks all resource paths' methods and if all methods under a
given path contain a condition, a composite condition is added to the overall template Conditions section and
that composite condition is added to the resource path.