def on_before_transform_template(self, template_dict):
template = SamTemplate(template_dict)<EOL>self.existing_implicit_api_resource = copy.deepcopy(template.get(self.implicit_api_logical_id))<EOL>template.set(self.implicit_api_logical_id, ImplicitApiResource().to_dict())<EOL>errors = []<EOL>for logicalId, function in template.iterate(SamResourceType.Function.value):<EOL><INDENT>api_events = self._get_api_events(function)<EOL>condition = function.condition<EOL>if len(api_events) == <NUM_LIT:0>:<EOL><INDENT>continue<EOL><DEDENT>try:<EOL><INDENT>self._process_api_events(function, api_events, template, condition)<EOL><DEDENT>except InvalidEventException as ex:<EOL><INDENT>errors.append(InvalidResourceException(logicalId, ex.message))<EOL><DEDENT><DEDENT>self._maybe_add_condition_to_implicit_api(template_dict)<EOL>self._maybe_add_conditions_to_implicit_api_paths(template)<EOL>self._maybe_remove_implicit_api(template)<EOL>if len(errors) > <NUM_LIT:0>:<EOL><INDENT>raise InvalidDocumentException(errors)<EOL><DEDENT>
Hook method that gets called before the SAM template is processed.
The template has pass the validation and is guaranteed to contain a non-empty "Resources" section.

:param dict template_dict: Dictionary of the SAM template
:return: Nothing