We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
E7003 Errors when using Fn::Transform inside a Mapping
*cfn-lint version: 0.49.2*

*Description of issue.*
#2006 tightened what is considered valid for use in a Mapping.  This causes it to reject what otherwise appears to be a valid use of `Fn::Transform` as the body of a Mapping.

For example, this snippet is valid CFN:

```yaml
Mappings:
  AwsAgentPlatformMap:
    Fn::Transform:
      Name: AWS::Include
      Parameters:
        Location: s3://my-bucket-name/version/3.0.1/amazonlinux2/a-json-file.json
```

This usage trips the newly enhanced regex:

```
E7003 Mapping key (Fn::Transform) has invalid name. Name has to be alphanumeric, '-' or '.'
```

--- 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/rules/mappings/KeyName.py`
Content:
```
1 """
2 Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 SPDX-License-Identifier: MIT-0
4 """
5 import re
6 import six
7 from cfnlint.rules import CloudFormationLintRule
8 from cfnlint.rules import RuleMatch
9 from cfnlint.helpers import REGEX_ALPHANUMERIC
10 
11 
12 class KeyName(CloudFormationLintRule):
13     """Check if Mapping Keys are type string"""
14     id = 'E7003'
15     shortdesc = 'Mapping keys are strings and alphanumeric'
16     description = 'Check if Mappings keys are properly typed as strings and alphanumeric'
17     source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html'
18     tags = ['mappings']
19 
20     def check_attribute(self, key, path):
21         """ Check the key name for string and alphanumeric"""
22         matches = []
23         if not isinstance(key, six.string_types):
24             message = 'Mapping attribute ({0}) has to be a string.'
25             matches.append(RuleMatch(path[:], message.format(key)))
26         elif not re.match(REGEX_ALPHANUMERIC, key):
27             message = 'Mapping attribute ({0}) has invalid name. Name has to be alphanumeric.'
28             matches.append(RuleMatch(path[:], message.format(key)))
29 
30         return matches
31 
32     def check_key(self, key, path):
33         """ Check the key name for string and alphanumeric"""
34         matches = []
35         if not isinstance(key, six.string_types):
36             message = 'Mapping key ({0}) has to be a string.'
37             matches.append(RuleMatch(path[:], message.format(key)))
38         elif not re.match('^[a-zA-Z0-9.-]{1,255}$', key):
39             message = 'Mapping key ({0}) has invalid name. Name has to be alphanumeric, \'-\' or \'.\''
40             matches.append(RuleMatch(path[:], message.format(key)))
41 
42         return matches
43 
44     def match(self, cfn):
45         matches = []
46 
47         mappings = cfn.template.get('Mappings', {})
48         for mapping_name, mapping_value in mappings.items():
49             if isinstance(mapping_value, dict):
50                 for key_name, key_value in mapping_value.items():
51                     matches.extend(self.check_key(
52                         key_name, ['Mappings', mapping_name, key_name]))
53                     if isinstance(key_value, dict):
54                         for sub_key_name, _ in key_value.items():
55                             matches.extend(
56                                 self.check_attribute(
57                                     sub_key_name, ['Mappings', mapping_name, key_name, sub_key_name]))
58 
59         return matches
60
```
--- 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/rules/mappings/KeyName.py b/src/cfnlint/rules/mappings/KeyName.py
--- a/src/cfnlint/rules/mappings/KeyName.py
+++ b/src/cfnlint/rules/mappings/KeyName.py
@@ -35,7 +35,7 @@
         if not isinstance(key, six.string_types):
             message = 'Mapping key ({0}) has to be a string.'
             matches.append(RuleMatch(path[:], message.format(key)))
-        elif not re.match('^[a-zA-Z0-9.-]{1,255}$', key):
+        elif not re.match('^[a-zA-Z0-9.-]{1,255}$', key) and key != 'Fn::Transform':
             message = 'Mapping key ({0}) has invalid name. Name has to be alphanumeric, \'-\' or \'.\''
             matches.append(RuleMatch(path[:], message.format(key)))

{"golden_diff": "diff --git a/src/cfnlint/rules/mappings/KeyName.py b/src/cfnlint/rules/mappings/KeyName.py\n--- a/src/cfnlint/rules/mappings/KeyName.py\n+++ b/src/cfnlint/rules/mappings/KeyName.py\n@@ -35,7 +35,7 @@\n         if not isinstance(key, six.string_types):\n             message = 'Mapping key ({0}) has to be a string.'\n             matches.append(RuleMatch(path[:], message.format(key)))\n-        elif not re.match('^[a-zA-Z0-9.-]{1,255}$', key):\n+        elif not re.match('^[a-zA-Z0-9.-]{1,255}$', key) and key != 'Fn::Transform':\n             message = 'Mapping key ({0}) has invalid name. Name has to be alphanumeric, \\'-\\' or \\'.\\''\n             matches.append(RuleMatch(path[:], message.format(key)))\n", "issue": "E7003 Errors when using Fn::Transform inside a Mapping\n*cfn-lint version: 0.49.2*\r\n\r\n*Description of issue.*\r\n#2006 tightened what is considered valid for use in a Mapping.  This causes it to reject what otherwise appears to be a valid use of `Fn::Transform` as the body of a Mapping.\r\n\r\nFor example, this snippet is valid CFN:\r\n\r\n```yaml\r\nMappings:\r\n  AwsAgentPlatformMap:\r\n    Fn::Transform:\r\n      Name: AWS::Include\r\n      Parameters:\r\n        Location: s3://my-bucket-name/version/3.0.1/amazonlinux2/a-json-file.json\r\n```\r\n\r\nThis usage trips the newly enhanced regex:\r\n\r\n```\r\nE7003 Mapping key (Fn::Transform) has invalid name. Name has to be alphanumeric, '-' or '.'\r\n```\n", "before_files": [{"content": "\"\"\"\nCopyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\nSPDX-License-Identifier: MIT-0\n\"\"\"\nimport re\nimport six\nfrom cfnlint.rules import CloudFormationLintRule\nfrom cfnlint.rules import RuleMatch\nfrom cfnlint.helpers import REGEX_ALPHANUMERIC\n\n\nclass KeyName(CloudFormationLintRule):\n    \"\"\"Check if Mapping Keys are type string\"\"\"\n    id = 'E7003'\n    shortdesc = 'Mapping keys are strings and alphanumeric'\n    description = 'Check if Mappings keys are properly typed as strings and alphanumeric'\n    source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html'\n    tags = ['mappings']\n\n    def check_attribute(self, key, path):\n        \"\"\" Check the key name for string and alphanumeric\"\"\"\n        matches = []\n        if not isinstance(key, six.string_types):\n            message = 'Mapping attribute ({0}) has to be a string.'\n            matches.append(RuleMatch(path[:], message.format(key)))\n        elif not re.match(REGEX_ALPHANUMERIC, key):\n            message = 'Mapping attribute ({0}) has invalid name. Name has to be alphanumeric.'\n            matches.append(RuleMatch(path[:], message.format(key)))\n\n        return matches\n\n    def check_key(self, key, path):\n        \"\"\" Check the key name for string and alphanumeric\"\"\"\n        matches = []\n        if not isinstance(key, six.string_types):\n            message = 'Mapping key ({0}) has to be a string.'\n            matches.append(RuleMatch(path[:], message.format(key)))\n        elif not re.match('^[a-zA-Z0-9.-]{1,255}$', key):\n            message = 'Mapping key ({0}) has invalid name. Name has to be alphanumeric, \\'-\\' or \\'.\\''\n            matches.append(RuleMatch(path[:], message.format(key)))\n\n        return matches\n\n    def match(self, cfn):\n        matches = []\n\n        mappings = cfn.template.get('Mappings', {})\n        for mapping_name, mapping_value in mappings.items():\n            if isinstance(mapping_value, dict):\n                for key_name, key_value in mapping_value.items():\n                    matches.extend(self.check_key(\n                        key_name, ['Mappings', mapping_name, key_name]))\n                    if isinstance(key_value, dict):\n                        for sub_key_name, _ in key_value.items():\n                            matches.extend(\n                                self.check_attribute(\n                                    sub_key_name, ['Mappings', mapping_name, key_name, sub_key_name]))\n\n        return matches\n", "path": "src/cfnlint/rules/mappings/KeyName.py"}], "after_files": [{"content": "\"\"\"\nCopyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\nSPDX-License-Identifier: MIT-0\n\"\"\"\nimport re\nimport six\nfrom cfnlint.rules import CloudFormationLintRule\nfrom cfnlint.rules import RuleMatch\nfrom cfnlint.helpers import REGEX_ALPHANUMERIC\n\n\nclass KeyName(CloudFormationLintRule):\n    \"\"\"Check if Mapping Keys are type string\"\"\"\n    id = 'E7003'\n    shortdesc = 'Mapping keys are strings and alphanumeric'\n    description = 'Check if Mappings keys are properly typed as strings and alphanumeric'\n    source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html'\n    tags = ['mappings']\n\n    def check_attribute(self, key, path):\n        \"\"\" Check the key name for string and alphanumeric\"\"\"\n        matches = []\n        if not isinstance(key, six.string_types):\n            message = 'Mapping attribute ({0}) has to be a string.'\n            matches.append(RuleMatch(path[:], message.format(key)))\n        elif not re.match(REGEX_ALPHANUMERIC, key):\n            message = 'Mapping attribute ({0}) has invalid name. Name has to be alphanumeric.'\n            matches.append(RuleMatch(path[:], message.format(key)))\n\n        return matches\n\n    def check_key(self, key, path):\n        \"\"\" Check the key name for string and alphanumeric\"\"\"\n        matches = []\n        if not isinstance(key, six.string_types):\n            message = 'Mapping key ({0}) has to be a string.'\n            matches.append(RuleMatch(path[:], message.format(key)))\n        elif not re.match('^[a-zA-Z0-9.-]{1,255}$', key) and key != 'Fn::Transform':\n            message = 'Mapping key ({0}) has invalid name. Name has to be alphanumeric, \\'-\\' or \\'.\\''\n            matches.append(RuleMatch(path[:], message.format(key)))\n\n        return matches\n\n    def match(self, cfn):\n        matches = []\n\n        mappings = cfn.template.get('Mappings', {})\n        for mapping_name, mapping_value in mappings.items():\n            if isinstance(mapping_value, dict):\n                for key_name, key_value in mapping_value.items():\n                    matches.extend(self.check_key(\n                        key_name, ['Mappings', mapping_name, key_name]))\n                    if isinstance(key_value, dict):\n                        for sub_key_name, _ in key_value.items():\n                            matches.extend(\n                                self.check_attribute(\n                                    sub_key_name, ['Mappings', mapping_name, key_name, sub_key_name]))\n\n        return matches\n", "path": "src/cfnlint/rules/mappings/KeyName.py"}]}