prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Nested mappings raise an error
  ```cfn-lint 0.3.1```
  
  We use nested maps in our templates:
  
  ```yaml
  Mappings:
    RegionAccountToAZ:
      ap-northeast-1:
        0123456789:
          - ap-northeast-1a
          - ap-northeast-1c
          - none
        9876543210:
          - ap-northeast-1a
          - ap-northeast-1b
          - ap-northeast-1c
  ```
  
  We'd access this data using a construction like `!FindInMap [RegionAccountToAZ, !Ref 'AWS::Region', !Ref 'AWS::AccountId']`. However cfn-lint says:
  
  ```
  E7001 Mapping RegionAccountToAZ has invalid property at 9876543210
  test.cfn.yaml:3:5
  
  E7001 Mapping RegionAccountToAZ has invalid property at 0123456789
  test.cfn.yaml:4:7
  ```
  
  </issue>
  <code>
  [start of src/cfnlint/rules/mappings/Configuration.py]
  1 """
  2   Copyright 2018 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 from cfnlint import CloudFormationLintRule
  18 from cfnlint import RuleMatch
  19 
  20 
  21 class Configuration(CloudFormationLintRule):
  22     """Check if Mappings are configured correctly"""
  23     id = 'E7001'
  24     shortdesc = 'Mappings are appropriately configured'
  25     description = 'Check if Mappings are properly configured'
  26     tags = ['base', 'mappings']
  27 
  28     def match(self, cfn):
  29         """Check CloudFormation Parameters"""
  30 
  31         matches = list()
  32 
  33         mappings = cfn.template.get('Mappings', {})
  34         if mappings:
  35             for mapname, mapobj in mappings.items():
  36                 if not isinstance(mapobj, dict):
  37                     message = 'Mapping {0} has invalid property'
  38                     matches.append(RuleMatch(
  39                         ['Mappings', mapname],
  40                         message.format(mapname)
  41                     ))
  42                 else:
  43                     for firstkey in mapobj:
  44                         firstkeyobj = mapobj[firstkey]
  45                         if not isinstance(firstkeyobj, dict):
  46                             message = 'Mapping {0} has invalid property at {1}'
  47                             matches.append(RuleMatch(
  48                                 ['Mappings', mapname, firstkey],
  49                                 message.format(mapname, firstkeyobj)
  50                             ))
  51                         else:
  52                             for secondkey in firstkeyobj:
  53                                 if isinstance(firstkeyobj[secondkey], (dict, list)):
  54                                     message = 'Mapping {0} has invalid property at {1}'
  55                                     matches.append(RuleMatch(
  56                                         ['Mappings', mapname, firstkey, secondkey],
  57                                         message.format(mapname, secondkey)
  58                                     ))
  59 
  60         return matches
  61
  [end of src/cfnlint/rules/mappings/Configuration.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/cfnlint/rules/mappings/Configuration.py b/src/cfnlint/rules/mappings/Configuration.py
  --- a/src/cfnlint/rules/mappings/Configuration.py
  +++ b/src/cfnlint/rules/mappings/Configuration.py
  @@ -14,6 +14,7 @@
     OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   """
  +import six
   from cfnlint import CloudFormationLintRule
   from cfnlint import RuleMatch
   
  @@ -50,7 +51,9 @@
                               ))
                           else:
                               for secondkey in firstkeyobj:
  -                                if isinstance(firstkeyobj[secondkey], (dict, list)):
  +                                if not isinstance(
  +                                        firstkeyobj[secondkey],
  +                                        (six.string_types, list, six.integer_types)):
                                       message = 'Mapping {0} has invalid property at {1}'
                                       matches.append(RuleMatch(
                                           ['Mappings', mapname, firstkey, secondkey],
  
verification_info: {"golden_diff": "diff --git a/src/cfnlint/rules/mappings/Configuration.py b/src/cfnlint/rules/mappings/Configuration.py\n--- a/src/cfnlint/rules/mappings/Configuration.py\n+++ b/src/cfnlint/rules/mappings/Configuration.py\n@@ -14,6 +14,7 @@\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 \"\"\"\n+import six\n from cfnlint import CloudFormationLintRule\n from cfnlint import RuleMatch\n \n@@ -50,7 +51,9 @@\n                             ))\n                         else:\n                             for secondkey in firstkeyobj:\n-                                if isinstance(firstkeyobj[secondkey], (dict, list)):\n+                                if not isinstance(\n+                                        firstkeyobj[secondkey],\n+                                        (six.string_types, list, six.integer_types)):\n                                     message = 'Mapping {0} has invalid property at {1}'\n                                     matches.append(RuleMatch(\n                                         ['Mappings', mapname, firstkey, secondkey],\n", "issue": "Nested mappings raise an error\n```cfn-lint 0.3.1```\r\n\r\nWe use nested maps in our templates:\r\n\r\n```yaml\r\nMappings:\r\n  RegionAccountToAZ:\r\n    ap-northeast-1:\r\n      0123456789:\r\n        - ap-northeast-1a\r\n        - ap-northeast-1c\r\n        - none\r\n      9876543210:\r\n        - ap-northeast-1a\r\n        - ap-northeast-1b\r\n        - ap-northeast-1c\r\n```\r\n\r\nWe'd access this data using a construction like `!FindInMap [RegionAccountToAZ, !Ref 'AWS::Region', !Ref 'AWS::AccountId']`. However cfn-lint says:\r\n\r\n```\r\nE7001 Mapping RegionAccountToAZ has invalid property at 9876543210\r\ntest.cfn.yaml:3:5\r\n\r\nE7001 Mapping RegionAccountToAZ has invalid property at 0123456789\r\ntest.cfn.yaml:4:7\r\n```\n", "before_files": [{"content": "\"\"\"\n  Copyright 2018 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\"\"\"\nfrom cfnlint import CloudFormationLintRule\nfrom cfnlint import RuleMatch\n\n\nclass Configuration(CloudFormationLintRule):\n    \"\"\"Check if Mappings are configured correctly\"\"\"\n    id = 'E7001'\n    shortdesc = 'Mappings are appropriately configured'\n    description = 'Check if Mappings are properly configured'\n    tags = ['base', 'mappings']\n\n    def match(self, cfn):\n        \"\"\"Check CloudFormation Parameters\"\"\"\n\n        matches = list()\n\n        mappings = cfn.template.get('Mappings', {})\n        if mappings:\n            for mapname, mapobj in mappings.items():\n                if not isinstance(mapobj, dict):\n                    message = 'Mapping {0} has invalid property'\n                    matches.append(RuleMatch(\n                        ['Mappings', mapname],\n                        message.format(mapname)\n                    ))\n                else:\n                    for firstkey in mapobj:\n                        firstkeyobj = mapobj[firstkey]\n                        if not isinstance(firstkeyobj, dict):\n                            message = 'Mapping {0} has invalid property at {1}'\n                            matches.append(RuleMatch(\n                                ['Mappings', mapname, firstkey],\n                                message.format(mapname, firstkeyobj)\n                            ))\n                        else:\n                            for secondkey in firstkeyobj:\n                                if isinstance(firstkeyobj[secondkey], (dict, list)):\n                                    message = 'Mapping {0} has invalid property at {1}'\n                                    matches.append(RuleMatch(\n                                        ['Mappings', mapname, firstkey, secondkey],\n                                        message.format(mapname, secondkey)\n                                    ))\n\n        return matches\n", "path": "src/cfnlint/rules/mappings/Configuration.py"}]}