def _maybe_add_condition_to_implicit_api(self, template_dict):
<EOL>if not self.api_conditions.get(self.implicit_api_logical_id, {}):<EOL><INDENT>return<EOL><DEDENT>implicit_api_conditions = self.api_conditions[self.implicit_api_logical_id]<EOL>all_resource_method_conditions = set([condition<EOL>for path, method_conditions in implicit_api_conditions.items()<EOL>for method, condition in method_conditions.items()])<EOL>at_least_one_resource_method = len(all_resource_method_conditions) > <NUM_LIT:0><EOL>all_resource_methods_contain_conditions = None not in all_resource_method_conditions<EOL>if at_least_one_resource_method and all_resource_methods_contain_conditions:<EOL><INDENT>implicit_api_resource = template_dict.get('<STR_LIT>').get(self.implicit_api_logical_id)<EOL>if len(all_resource_method_conditions) == <NUM_LIT:1>:<EOL><INDENT>condition = all_resource_method_conditions.pop()<EOL>implicit_api_resource['<STR_LIT>'] = condition<EOL><DEDENT>else:<EOL><INDENT>implicit_api_resource['<STR_LIT>'] = self.implicit_api_condition<EOL>self._add_combined_condition_to_template(<EOL>template_dict, self.implicit_api_condition, all_resource_method_conditions)<EOL><DEDENT><DEDENT>
Decides whether to add a condition to the implicit api resource.
:param dict template_dict: SAM template dictionary