def on_before_transform_resource(self, logical_id, resource_type, resource_properties):
if not self._resource_is_supported(resource_type):<EOL><INDENT>return<EOL><DEDENT>self._check_for_dictionary_key(logical_id, resource_properties, [self.LOCATION_KEY])<EOL>if not isinstance(resource_properties[self.LOCATION_KEY], dict):<EOL><INDENT>resource_properties[self.TEMPLATE_URL_KEY] = resource_properties[self.LOCATION_KEY]<EOL>return<EOL><DEDENT>self._check_for_dictionary_key(logical_id, resource_properties[self.LOCATION_KEY],<EOL>[self.APPLICATION_ID_KEY, self.SEMANTIC_VERSION_KEY])<EOL>app_id = resource_properties[self.LOCATION_KEY].get(self.APPLICATION_ID_KEY)<EOL>if not app_id:<EOL><INDENT>raise InvalidResourceException(logical_id, "<STR_LIT>")<EOL><DEDENT>if isinstance(app_id, dict):<EOL><INDENT>raise InvalidResourceException(logical_id, "<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>semver = resource_properties[self.LOCATION_KEY].get(self.SEMANTIC_VERSION_KEY)<EOL>if not semver:<EOL><INDENT>raise InvalidResourceException(logical_id, "<STR_LIT>")<EOL><DEDENT>if isinstance(semver, dict):<EOL><INDENT>raise InvalidResourceException(logical_id, "<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>key = (app_id, semver)<EOL>if isinstance(self._applications[key], InvalidResourceException):<EOL><INDENT>raise self._applications[key]<EOL><DEDENT>if not self._validate_only:<EOL><INDENT>resource_properties[self.TEMPLATE_URL_KEY] = self._applications[key]<EOL><DEDENT>
Hook method that gets called before "each" SAM resource gets processed

Replaces the ApplicationId and Semantic Version pairs with a TemplateUrl.

:param string logical_id: Logical ID of the resource being processed
:param string resource_type: Type of the resource being processed
:param dict resource_properties: Properties of the resource
:return: Nothing