We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
AutoPublishAlias with a !Ref value marked as false positive
*cfn-lint version: 0.11.1*

I'm running into an issue with `AutoPublishAlias`. When using a `!Ref` as its value, I get the following error message:
```
E0001 Resource with id [SkillFunction] is invalid. 'AutoPublishAlias' must be a string or a Ref to a template parameter
foo.yml:1:1
```

Here's the minimal template to reproduce the issue:
```yaml
---

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Parameters:
  Stage:
    Description: Environment stage (deployment phase)
    Type: String
    AllowedValues:
      - beta
      - prod

Resources:
  SkillFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: '.'
      Handler: main.handler
      Runtime: python3.7
      Timeout: 30
      MemorySize: 128
      AutoPublishAlias: !Ref Stage
```

The error message is actually very helpful (👏 for that), but as you can see, I am using a `!Ref` to a template parameter, so this should not cause a linting error.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/cfnlint/transform.py`
Content:
```
1 """
2   Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 
4   Permission is hereby granted, free of charge, to any person obtaining a copy of this
5   software and associated documentation files (the "Software"), to deal in the Software
6   without restriction, including without limitation the rights to use, copy, modify,
7   merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
8   permit persons to whom the Software is furnished to do so.
9 
10   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
11   INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
12   PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
13   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
14   OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
15   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16 """
17 import os
18 import logging
19 import six
20 import samtranslator
21 from samtranslator.parser import parser
22 from samtranslator.translator.translator import Translator
23 from samtranslator.public.exceptions import InvalidDocumentException
24 
25 import cfnlint.helpers
26 LOGGER = logging.getLogger('cfnlint')
27 
28 class Transform(object):
29     """
30     Application Serverless Module tranform Wrappor. Based on code from AWS SAM CLI:
31     https://github.com/awslabs/aws-sam-cli/blob/develop/samcli/commands/validate/lib/sam_template_validator.py
32     """
33 
34     def __init__(self, filename, template, region):
35         """
36         Initialize Transform class
37         """
38         self._filename = filename
39         self._template = template
40         self._region = region
41 
42         self._managed_policy_map = self.load_managed_policies()
43         self._sam_parser = parser.Parser()
44 
45     def template(self):
46         """Get the template"""
47         return self._template
48 
49     def load_managed_policies(self):
50         """
51         Load the ManagedPolicies locally, based on the AWS-CLI:
52         https://github.com/awslabs/aws-sam-cli/blob/develop/samcli/lib/samlib/default_managed_policies.json
53         """
54         return cfnlint.helpers.load_resources('data/Serverless/ManagedPolicies.json')
55 
56     def _replace_local_codeuri(self):
57         """
58         Replaces the CodeUri in AWS::Serverless::Function and DefinitionUri in AWS::Serverless::Api to a fake
59         S3 Uri. This is to support running the SAM Translator with valid values for these fields. If this in not done,
60         the template is invalid in the eyes of SAM Translator (the translator does not support local paths)
61         """
62 
63         all_resources = self._template.get('Resources', {})
64 
65         for _, resource in all_resources.items():
66 
67             resource_type = resource.get('Type')
68             resource_dict = resource.get('Properties')
69 
70             if resource_type == 'AWS::Serverless::Function':
71 
72                 Transform._update_to_s3_uri('CodeUri', resource_dict)
73             if resource_type in ['AWS::Serverless::LayerVersion']:
74                 if resource_dict.get('ContentUri'):
75                     Transform._update_to_s3_uri('ContentUri', resource_dict)
76             if resource_type == 'AWS::Serverless::Application':
77                 if resource_dict.get('Location'):
78                     resource_dict['Location'] = ''
79                     Transform._update_to_s3_uri('Location', resource_dict)
80             if resource_type == 'AWS::Serverless::Api':
81                 if 'DefinitionBody' not in resource_dict and 'Auth' not in resource_dict:
82                     Transform._update_to_s3_uri('DefinitionUri', resource_dict)
83                 else:
84                     resource_dict['DefinitionBody'] = ''
85 
86     def transform_template(self):
87         """
88         Transform the Template using the Serverless Application Model.
89         """
90         matches = []
91 
92         try:
93             # Output the SAM Translator version in debug mode
94             LOGGER.info('SAM Translator: %s', samtranslator.__version__)
95 
96             sam_translator = Translator(managed_policy_map=self._managed_policy_map,
97                                         sam_parser=self._sam_parser)
98 
99             self._replace_local_codeuri()
100 
101             # Tell SAM to use the region we're linting in, this has to be controlled using the default AWS mechanisms, see also:
102             # https://github.com/awslabs/serverless-application-model/blob/master/samtranslator/translator/arn_generator.py
103             LOGGER.info('Setting AWS_DEFAULT_REGION to %s', self._region)
104             os.environ['AWS_DEFAULT_REGION'] = self._region
105 
106             self._template = cfnlint.helpers.convert_dict(
107                 sam_translator.translate(sam_template=self._template, parameter_values={}))
108 
109             LOGGER.info('Transformed template: \n%s', cfnlint.helpers.format_json_string(self._template))
110         except InvalidDocumentException as e:
111             message = 'Error transforming template: {0}'
112             for cause in e.causes:
113                 matches.append(cfnlint.Match(
114                     1, 1,
115                     1, 1,
116                     self._filename, cfnlint.TransformError(), message.format(cause.message)))
117         except Exception as e:  # pylint: disable=W0703
118             LOGGER.debug('Error transforming template: %s', str(e))
119             LOGGER.debug('Stack trace: %s', e, exc_info=True)
120             message = 'Error transforming template: {0}'
121             matches.append(cfnlint.Match(
122                 1, 1,
123                 1, 1,
124                 self._filename, cfnlint.TransformError(), message.format(str(e))))
125 
126         return matches
127 
128     @staticmethod
129     def is_s3_uri(uri):
130         """
131         Checks the uri and determines if it is a valid S3 Uri
132         Parameters
133         ----------
134         uri str, required
135             Uri to check
136         Returns
137         -------
138         bool
139             Returns True if the uri given is an S3 uri, otherwise False
140         """
141         return isinstance(uri, six.string_types) and uri.startswith('s3://')
142 
143     @staticmethod
144     def _update_to_s3_uri(property_key, resource_property_dict, s3_uri_value='s3://bucket/value'):
145         """
146         Updates the 'property_key' in the 'resource_property_dict' to the value of 's3_uri_value'
147         Note: The function will mutate the resource_property_dict that is pass in
148         Parameters
149         ----------
150         property_key str, required
151             Key in the resource_property_dict
152         resource_property_dict dict, required
153             Property dictionary of a Resource in the template to replace
154         s3_uri_value str, optional
155             Value to update the value of the property_key to
156         """
157         uri_property = resource_property_dict.get(property_key, '.')
158 
159         # ignore if dict or already an S3 Uri
160         if isinstance(uri_property, dict) or Transform.is_s3_uri(uri_property):
161             return
162 
163         resource_property_dict[property_key] = s3_uri_value
164
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/cfnlint/transform.py b/src/cfnlint/transform.py
--- a/src/cfnlint/transform.py
+++ b/src/cfnlint/transform.py
@@ -38,6 +38,7 @@
         self._filename = filename
         self._template = template
         self._region = region
+        self._parameters = {}
 
         self._managed_policy_map = self.load_managed_policies()
         self._sam_parser = parser.Parser()
@@ -70,6 +71,13 @@
             if resource_type == 'AWS::Serverless::Function':
 
                 Transform._update_to_s3_uri('CodeUri', resource_dict)
+                auto_publish_alias = resource_dict.get('AutoPublishAlias')
+                if isinstance(auto_publish_alias, dict):
+                    if len(auto_publish_alias) == 1:
+                        for k, v in auto_publish_alias.items():
+                            if k == 'Ref':
+                                if v in self._template.get('Parameters'):
+                                    self._parameters[v] = 'Alias'
             if resource_type in ['AWS::Serverless::LayerVersion']:
                 if resource_dict.get('ContentUri'):
                     Transform._update_to_s3_uri('ContentUri', resource_dict)
@@ -104,7 +112,10 @@
             os.environ['AWS_DEFAULT_REGION'] = self._region
 
             self._template = cfnlint.helpers.convert_dict(
-                sam_translator.translate(sam_template=self._template, parameter_values={}))
+                sam_translator.translate(sam_template=self._template, parameter_values=self._parameters))
+
+            for p_name in self._parameters:
+                del self._template['Parameters'][p_name]
 
             LOGGER.info('Transformed template: \n%s', cfnlint.helpers.format_json_string(self._template))
         except InvalidDocumentException as e:

{"golden_diff": "diff --git a/src/cfnlint/transform.py b/src/cfnlint/transform.py\n--- a/src/cfnlint/transform.py\n+++ b/src/cfnlint/transform.py\n@@ -38,6 +38,7 @@\n         self._filename = filename\n         self._template = template\n         self._region = region\n+        self._parameters = {}\n \n         self._managed_policy_map = self.load_managed_policies()\n         self._sam_parser = parser.Parser()\n@@ -70,6 +71,13 @@\n             if resource_type == 'AWS::Serverless::Function':\n \n                 Transform._update_to_s3_uri('CodeUri', resource_dict)\n+                auto_publish_alias = resource_dict.get('AutoPublishAlias')\n+                if isinstance(auto_publish_alias, dict):\n+                    if len(auto_publish_alias) == 1:\n+                        for k, v in auto_publish_alias.items():\n+                            if k == 'Ref':\n+                                if v in self._template.get('Parameters'):\n+                                    self._parameters[v] = 'Alias'\n             if resource_type in ['AWS::Serverless::LayerVersion']:\n                 if resource_dict.get('ContentUri'):\n                     Transform._update_to_s3_uri('ContentUri', resource_dict)\n@@ -104,7 +112,10 @@\n             os.environ['AWS_DEFAULT_REGION'] = self._region\n \n             self._template = cfnlint.helpers.convert_dict(\n-                sam_translator.translate(sam_template=self._template, parameter_values={}))\n+                sam_translator.translate(sam_template=self._template, parameter_values=self._parameters))\n+\n+            for p_name in self._parameters:\n+                del self._template['Parameters'][p_name]\n \n             LOGGER.info('Transformed template: \\n%s', cfnlint.helpers.format_json_string(self._template))\n         except InvalidDocumentException as e:\n", "issue": "AutoPublishAlias with a !Ref value marked as false positive\n*cfn-lint version: 0.11.1*\r\n\r\nI'm running into an issue with `AutoPublishAlias`. When using a `!Ref` as its value, I get the following error message:\r\n```\r\nE0001 Resource with id [SkillFunction] is invalid. 'AutoPublishAlias' must be a string or a Ref to a template parameter\r\nfoo.yml:1:1\r\n```\r\n\r\nHere's the minimal template to reproduce the issue:\r\n```yaml\r\n---\r\n\r\nAWSTemplateFormatVersion: '2010-09-09'\r\nTransform: AWS::Serverless-2016-10-31\r\n\r\nParameters:\r\n  Stage:\r\n    Description: Environment stage (deployment phase)\r\n    Type: String\r\n    AllowedValues:\r\n      - beta\r\n      - prod\r\n\r\nResources:\r\n  SkillFunction:\r\n    Type: AWS::Serverless::Function\r\n    Properties:\r\n      CodeUri: '.'\r\n      Handler: main.handler\r\n      Runtime: python3.7\r\n      Timeout: 30\r\n      MemorySize: 128\r\n      AutoPublishAlias: !Ref Stage\r\n```\r\n\r\nThe error message is actually very helpful (\ud83d\udc4f for that), but as you can see, I am using a `!Ref` to a template parameter, so this should not cause a linting error.\n", "before_files": [{"content": "\"\"\"\n  Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n\n  Permission is hereby granted, free of charge, to any person obtaining a copy of this\n  software and associated documentation files (the \"Software\"), to deal in the Software\n  without restriction, including without limitation the rights to use, copy, modify,\n  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n  permit persons to whom the Software is furnished to do so.\n\n  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\"\"\"\nimport os\nimport logging\nimport six\nimport samtranslator\nfrom samtranslator.parser import parser\nfrom samtranslator.translator.translator import Translator\nfrom samtranslator.public.exceptions import InvalidDocumentException\n\nimport cfnlint.helpers\nLOGGER = logging.getLogger('cfnlint')\n\nclass Transform(object):\n    \"\"\"\n    Application Serverless Module tranform Wrappor. Based on code from AWS SAM CLI:\n    https://github.com/awslabs/aws-sam-cli/blob/develop/samcli/commands/validate/lib/sam_template_validator.py\n    \"\"\"\n\n    def __init__(self, filename, template, region):\n        \"\"\"\n        Initialize Transform class\n        \"\"\"\n        self._filename = filename\n        self._template = template\n        self._region = region\n\n        self._managed_policy_map = self.load_managed_policies()\n        self._sam_parser = parser.Parser()\n\n    def template(self):\n        \"\"\"Get the template\"\"\"\n        return self._template\n\n    def load_managed_policies(self):\n        \"\"\"\n        Load the ManagedPolicies locally, based on the AWS-CLI:\n        https://github.com/awslabs/aws-sam-cli/blob/develop/samcli/lib/samlib/default_managed_policies.json\n        \"\"\"\n        return cfnlint.helpers.load_resources('data/Serverless/ManagedPolicies.json')\n\n    def _replace_local_codeuri(self):\n        \"\"\"\n        Replaces the CodeUri in AWS::Serverless::Function and DefinitionUri in AWS::Serverless::Api to a fake\n        S3 Uri. This is to support running the SAM Translator with valid values for these fields. If this in not done,\n        the template is invalid in the eyes of SAM Translator (the translator does not support local paths)\n        \"\"\"\n\n        all_resources = self._template.get('Resources', {})\n\n        for _, resource in all_resources.items():\n\n            resource_type = resource.get('Type')\n            resource_dict = resource.get('Properties')\n\n            if resource_type == 'AWS::Serverless::Function':\n\n                Transform._update_to_s3_uri('CodeUri', resource_dict)\n            if resource_type in ['AWS::Serverless::LayerVersion']:\n                if resource_dict.get('ContentUri'):\n                    Transform._update_to_s3_uri('ContentUri', resource_dict)\n            if resource_type == 'AWS::Serverless::Application':\n                if resource_dict.get('Location'):\n                    resource_dict['Location'] = ''\n                    Transform._update_to_s3_uri('Location', resource_dict)\n            if resource_type == 'AWS::Serverless::Api':\n                if 'DefinitionBody' not in resource_dict and 'Auth' not in resource_dict:\n                    Transform._update_to_s3_uri('DefinitionUri', resource_dict)\n                else:\n                    resource_dict['DefinitionBody'] = ''\n\n    def transform_template(self):\n        \"\"\"\n        Transform the Template using the Serverless Application Model.\n        \"\"\"\n        matches = []\n\n        try:\n            # Output the SAM Translator version in debug mode\n            LOGGER.info('SAM Translator: %s', samtranslator.__version__)\n\n            sam_translator = Translator(managed_policy_map=self._managed_policy_map,\n                                        sam_parser=self._sam_parser)\n\n            self._replace_local_codeuri()\n\n            # Tell SAM to use the region we're linting in, this has to be controlled using the default AWS mechanisms, see also:\n            # https://github.com/awslabs/serverless-application-model/blob/master/samtranslator/translator/arn_generator.py\n            LOGGER.info('Setting AWS_DEFAULT_REGION to %s', self._region)\n            os.environ['AWS_DEFAULT_REGION'] = self._region\n\n            self._template = cfnlint.helpers.convert_dict(\n                sam_translator.translate(sam_template=self._template, parameter_values={}))\n\n            LOGGER.info('Transformed template: \\n%s', cfnlint.helpers.format_json_string(self._template))\n        except InvalidDocumentException as e:\n            message = 'Error transforming template: {0}'\n            for cause in e.causes:\n                matches.append(cfnlint.Match(\n                    1, 1,\n                    1, 1,\n                    self._filename, cfnlint.TransformError(), message.format(cause.message)))\n        except Exception as e:  # pylint: disable=W0703\n            LOGGER.debug('Error transforming template: %s', str(e))\n            LOGGER.debug('Stack trace: %s', e, exc_info=True)\n            message = 'Error transforming template: {0}'\n            matches.append(cfnlint.Match(\n                1, 1,\n                1, 1,\n                self._filename, cfnlint.TransformError(), message.format(str(e))))\n\n        return matches\n\n    @staticmethod\n    def is_s3_uri(uri):\n        \"\"\"\n        Checks the uri and determines if it is a valid S3 Uri\n        Parameters\n        ----------\n        uri str, required\n            Uri to check\n        Returns\n        -------\n        bool\n            Returns True if the uri given is an S3 uri, otherwise False\n        \"\"\"\n        return isinstance(uri, six.string_types) and uri.startswith('s3://')\n\n    @staticmethod\n    def _update_to_s3_uri(property_key, resource_property_dict, s3_uri_value='s3://bucket/value'):\n        \"\"\"\n        Updates the 'property_key' in the 'resource_property_dict' to the value of 's3_uri_value'\n        Note: The function will mutate the resource_property_dict that is pass in\n        Parameters\n        ----------\n        property_key str, required\n            Key in the resource_property_dict\n        resource_property_dict dict, required\n            Property dictionary of a Resource in the template to replace\n        s3_uri_value str, optional\n            Value to update the value of the property_key to\n        \"\"\"\n        uri_property = resource_property_dict.get(property_key, '.')\n\n        # ignore if dict or already an S3 Uri\n        if isinstance(uri_property, dict) or Transform.is_s3_uri(uri_property):\n            return\n\n        resource_property_dict[property_key] = s3_uri_value\n", "path": "src/cfnlint/transform.py"}], "after_files": [{"content": "\"\"\"\n  Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n\n  Permission is hereby granted, free of charge, to any person obtaining a copy of this\n  software and associated documentation files (the \"Software\"), to deal in the Software\n  without restriction, including without limitation the rights to use, copy, modify,\n  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n  permit persons to whom the Software is furnished to do so.\n\n  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\"\"\"\nimport os\nimport logging\nimport six\nimport samtranslator\nfrom samtranslator.parser import parser\nfrom samtranslator.translator.translator import Translator\nfrom samtranslator.public.exceptions import InvalidDocumentException\n\nimport cfnlint.helpers\nLOGGER = logging.getLogger('cfnlint')\n\nclass Transform(object):\n    \"\"\"\n    Application Serverless Module tranform Wrappor. Based on code from AWS SAM CLI:\n    https://github.com/awslabs/aws-sam-cli/blob/develop/samcli/commands/validate/lib/sam_template_validator.py\n    \"\"\"\n\n    def __init__(self, filename, template, region):\n        \"\"\"\n        Initialize Transform class\n        \"\"\"\n        self._filename = filename\n        self._template = template\n        self._region = region\n        self._parameters = {}\n\n        self._managed_policy_map = self.load_managed_policies()\n        self._sam_parser = parser.Parser()\n\n    def template(self):\n        \"\"\"Get the template\"\"\"\n        return self._template\n\n    def load_managed_policies(self):\n        \"\"\"\n        Load the ManagedPolicies locally, based on the AWS-CLI:\n        https://github.com/awslabs/aws-sam-cli/blob/develop/samcli/lib/samlib/default_managed_policies.json\n        \"\"\"\n        return cfnlint.helpers.load_resources('data/Serverless/ManagedPolicies.json')\n\n    def _replace_local_codeuri(self):\n        \"\"\"\n        Replaces the CodeUri in AWS::Serverless::Function and DefinitionUri in AWS::Serverless::Api to a fake\n        S3 Uri. This is to support running the SAM Translator with valid values for these fields. If this in not done,\n        the template is invalid in the eyes of SAM Translator (the translator does not support local paths)\n        \"\"\"\n\n        all_resources = self._template.get('Resources', {})\n\n        for _, resource in all_resources.items():\n\n            resource_type = resource.get('Type')\n            resource_dict = resource.get('Properties')\n\n            if resource_type == 'AWS::Serverless::Function':\n\n                Transform._update_to_s3_uri('CodeUri', resource_dict)\n                auto_publish_alias = resource_dict.get('AutoPublishAlias')\n                if isinstance(auto_publish_alias, dict):\n                    if len(auto_publish_alias) == 1:\n                        for k, v in auto_publish_alias.items():\n                            if k == 'Ref':\n                                if v in self._template.get('Parameters'):\n                                    self._parameters[v] = 'Alias'\n            if resource_type in ['AWS::Serverless::LayerVersion']:\n                if resource_dict.get('ContentUri'):\n                    Transform._update_to_s3_uri('ContentUri', resource_dict)\n            if resource_type == 'AWS::Serverless::Application':\n                if resource_dict.get('Location'):\n                    resource_dict['Location'] = ''\n                    Transform._update_to_s3_uri('Location', resource_dict)\n            if resource_type == 'AWS::Serverless::Api':\n                if 'DefinitionBody' not in resource_dict and 'Auth' not in resource_dict:\n                    Transform._update_to_s3_uri('DefinitionUri', resource_dict)\n                else:\n                    resource_dict['DefinitionBody'] = ''\n\n    def transform_template(self):\n        \"\"\"\n        Transform the Template using the Serverless Application Model.\n        \"\"\"\n        matches = []\n\n        try:\n            # Output the SAM Translator version in debug mode\n            LOGGER.info('SAM Translator: %s', samtranslator.__version__)\n\n            sam_translator = Translator(managed_policy_map=self._managed_policy_map,\n                                        sam_parser=self._sam_parser)\n\n            self._replace_local_codeuri()\n\n            # Tell SAM to use the region we're linting in, this has to be controlled using the default AWS mechanisms, see also:\n            # https://github.com/awslabs/serverless-application-model/blob/master/samtranslator/translator/arn_generator.py\n            LOGGER.info('Setting AWS_DEFAULT_REGION to %s', self._region)\n            os.environ['AWS_DEFAULT_REGION'] = self._region\n\n            self._template = cfnlint.helpers.convert_dict(\n                sam_translator.translate(sam_template=self._template, parameter_values=self._parameters))\n\n            for p_name in self._parameters:\n                del self._template['Parameters'][p_name]\n\n            LOGGER.info('Transformed template: \\n%s', cfnlint.helpers.format_json_string(self._template))\n        except InvalidDocumentException as e:\n            message = 'Error transforming template: {0}'\n            for cause in e.causes:\n                matches.append(cfnlint.Match(\n                    1, 1,\n                    1, 1,\n                    self._filename, cfnlint.TransformError(), message.format(cause.message)))\n        except Exception as e:  # pylint: disable=W0703\n            LOGGER.debug('Error transforming template: %s', str(e))\n            LOGGER.debug('Stack trace: %s', e, exc_info=True)\n            message = 'Error transforming template: {0}'\n            matches.append(cfnlint.Match(\n                1, 1,\n                1, 1,\n                self._filename, cfnlint.TransformError(), message.format(str(e))))\n\n        return matches\n\n    @staticmethod\n    def is_s3_uri(uri):\n        \"\"\"\n        Checks the uri and determines if it is a valid S3 Uri\n        Parameters\n        ----------\n        uri str, required\n            Uri to check\n        Returns\n        -------\n        bool\n            Returns True if the uri given is an S3 uri, otherwise False\n        \"\"\"\n        return isinstance(uri, six.string_types) and uri.startswith('s3://')\n\n    @staticmethod\n    def _update_to_s3_uri(property_key, resource_property_dict, s3_uri_value='s3://bucket/value'):\n        \"\"\"\n        Updates the 'property_key' in the 'resource_property_dict' to the value of 's3_uri_value'\n        Note: The function will mutate the resource_property_dict that is pass in\n        Parameters\n        ----------\n        property_key str, required\n            Key in the resource_property_dict\n        resource_property_dict dict, required\n            Property dictionary of a Resource in the template to replace\n        s3_uri_value str, optional\n            Value to update the value of the property_key to\n        \"\"\"\n        uri_property = resource_property_dict.get(property_key, '.')\n\n        # ignore if dict or already an S3 Uri\n        if isinstance(uri_property, dict) or Transform.is_s3_uri(uri_property):\n            return\n\n        resource_property_dict[property_key] = s3_uri_value\n", "path": "src/cfnlint/transform.py"}]}