prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Using `Fn::Split` in `ManagedPolicyArns` as part of a `AWS::IAM::Role` results in incorrect E1018 error
  *cfn-lint version: 0.4.2*
  
  *Description of issue.*
  
  Using `Fn::Split` in `ManagedPolicyArns` as part of a `AWS::IAM::Role` results in incorrect E1018 error.
  
  e.g.
  ```
  E1018 Split unsupported function for Resources/EnhancedMonitoringRole/Properties/ManagedPolicyArns/Fn::Split
  ```
  
  However, I think this is incorrect, since I have been able to produce a working stack based off a template that has this snippet:
  
  ```
  ...<snip>...
  Parameters:
    MandatoryPolicies:
      Description: Provide a list of policies that are mandatory on all roles
      Type: CommaDelimitedList
  ...<snip>...
  Resources:
    EnhancedMonitoringRole:
      Type: AWS::IAM::Role
      Properties:
        Path: /
        AssumeRolePolicyDocument:
          Version: 2012-10-17
          Statement:
            - Effect: Allow
              Principal:
                Service: monitoring.rds.amazonaws.com
              Action: sts:AssumeRole
        ManagedPolicyArns: !Split
          - ","
          - !Sub
            - "${PolicyList},arn:aws:iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole"
            - PolicyList: !Join [",", !Ref "MandatoryPolicies"]
  ```
  
  I passed the parameter this string (well, this is a sanitised version of it anyway...):
  ```
  arn:aws:iam::999912312399:policy/SecOpsRestrictionPolicy,arn:aws:iam::999912312399:policy/IAMRestrictionPolicy
  ``` 
  
  If you point me in the right direction, I may be able to contribute a patch.
  
  </issue>
  <code>
  [start of src/cfnlint/rules/functions/Split.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 import six
  18 from cfnlint import CloudFormationLintRule
  19 from cfnlint import RuleMatch
  20 
  21 
  22 class Split(CloudFormationLintRule):
  23     """Check if Split values are correct"""
  24     id = 'E1018'
  25     shortdesc = 'Split validation of parameters'
  26     description = 'Making sure the split function is properly configured'
  27     source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-split.html'
  28     tags = ['functions', 'split']
  29 
  30     def match(self, cfn):
  31         """Check CloudFormation Join"""
  32 
  33         matches = list()
  34 
  35         split_objs = cfn.search_deep_keys('Fn::Split')
  36 
  37         supported_functions = [
  38             'Fn::Base64',
  39             'Fn::FindInMap',
  40             'Fn::GetAtt',
  41             'Fn::GetAZs',
  42             'Fn::ImportValue',
  43             'Fn::If',
  44             'Fn::Join',
  45             'Fn::Select',
  46             'Ref'
  47         ]
  48 
  49         for split_obj in split_objs:
  50             split_value_obj = split_obj[-1]
  51             tree = split_obj[:-1]
  52             if isinstance(split_value_obj, list):
  53                 if len(split_value_obj) == 2:
  54                     split_delimiter = split_value_obj[0]
  55                     split_string = split_value_obj[1]
  56                     if not isinstance(split_delimiter, six.string_types):
  57                         message = 'Split delimiter has to be of type string for {0}'
  58                         matches.append(RuleMatch(
  59                             tree + [0], message.format('/'.join(map(str, tree)))))
  60                     if isinstance(split_string, dict):
  61                         if len(split_string) == 1:
  62                             for key, _ in split_string.items():
  63                                 if key not in supported_functions:
  64                                     message = 'Split unsupported function for {0}'
  65                                     matches.append(RuleMatch(
  66                                         tree + [key], message.format('/'.join(map(str, tree)))))
  67                         else:
  68                             message = 'Split list of singular function or string for {0}'
  69                             matches.append(RuleMatch(
  70                                 tree, message.format('/'.join(map(str, tree)))))
  71                     elif not isinstance(split_string, six.string_types):
  72                         message = 'Split has to be of type string or valid function for {0}'
  73                         matches.append(RuleMatch(
  74                             tree, message.format('/'.join(map(str, tree)))))
  75                 else:
  76                     message = 'Split should be an array of 2 for {0}'
  77                     matches.append(RuleMatch(
  78                         tree, message.format('/'.join(map(str, tree)))))
  79             else:
  80                 message = 'Split should be an array of 2 for {0}'
  81                 matches.append(RuleMatch(
  82                     tree, message.format('/'.join(map(str, tree)))))
  83         return matches
  84
  [end of src/cfnlint/rules/functions/Split.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/functions/Split.py b/src/cfnlint/rules/functions/Split.py
  --- a/src/cfnlint/rules/functions/Split.py
  +++ b/src/cfnlint/rules/functions/Split.py
  @@ -43,6 +43,7 @@
               'Fn::If',
               'Fn::Join',
               'Fn::Select',
  +            'Fn::Sub',
               'Ref'
           ]
   
  @@ -61,9 +62,9 @@
                           if len(split_string) == 1:
                               for key, _ in split_string.items():
                                   if key not in supported_functions:
  -                                    message = 'Split unsupported function for {0}'
  +                                    message = 'Fn::Split doesn\'t support the function {0} at {1}'
                                       matches.append(RuleMatch(
  -                                        tree + [key], message.format('/'.join(map(str, tree)))))
  +                                        tree + [key], message.format(key, '/'.join(map(str, tree)))))
                           else:
                               message = 'Split list of singular function or string for {0}'
                               matches.append(RuleMatch(
  
verification_info: {"golden_diff": "diff --git a/src/cfnlint/rules/functions/Split.py b/src/cfnlint/rules/functions/Split.py\n--- a/src/cfnlint/rules/functions/Split.py\n+++ b/src/cfnlint/rules/functions/Split.py\n@@ -43,6 +43,7 @@\n             'Fn::If',\n             'Fn::Join',\n             'Fn::Select',\n+            'Fn::Sub',\n             'Ref'\n         ]\n \n@@ -61,9 +62,9 @@\n                         if len(split_string) == 1:\n                             for key, _ in split_string.items():\n                                 if key not in supported_functions:\n-                                    message = 'Split unsupported function for {0}'\n+                                    message = 'Fn::Split doesn\\'t support the function {0} at {1}'\n                                     matches.append(RuleMatch(\n-                                        tree + [key], message.format('/'.join(map(str, tree)))))\n+                                        tree + [key], message.format(key, '/'.join(map(str, tree)))))\n                         else:\n                             message = 'Split list of singular function or string for {0}'\n                             matches.append(RuleMatch(\n", "issue": "Using `Fn::Split` in `ManagedPolicyArns` as part of a `AWS::IAM::Role` results in incorrect E1018 error\n*cfn-lint version: 0.4.2*\r\n\r\n*Description of issue.*\r\n\r\nUsing `Fn::Split` in `ManagedPolicyArns` as part of a `AWS::IAM::Role` results in incorrect E1018 error.\r\n\r\ne.g.\r\n```\r\nE1018 Split unsupported function for Resources/EnhancedMonitoringRole/Properties/ManagedPolicyArns/Fn::Split\r\n```\r\n\r\nHowever, I think this is incorrect, since I have been able to produce a working stack based off a template that has this snippet:\r\n\r\n```\r\n...<snip>...\r\nParameters:\r\n  MandatoryPolicies:\r\n    Description: Provide a list of policies that are mandatory on all roles\r\n    Type: CommaDelimitedList\r\n...<snip>...\r\nResources:\r\n  EnhancedMonitoringRole:\r\n    Type: AWS::IAM::Role\r\n    Properties:\r\n      Path: /\r\n      AssumeRolePolicyDocument:\r\n        Version: 2012-10-17\r\n        Statement:\r\n          - Effect: Allow\r\n            Principal:\r\n              Service: monitoring.rds.amazonaws.com\r\n            Action: sts:AssumeRole\r\n      ManagedPolicyArns: !Split\r\n        - \",\"\r\n        - !Sub\r\n          - \"${PolicyList},arn:aws:iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole\"\r\n          - PolicyList: !Join [\",\", !Ref \"MandatoryPolicies\"]\r\n```\r\n\r\nI passed the parameter this string (well, this is a sanitised version of it anyway...):\r\n```\r\narn:aws:iam::999912312399:policy/SecOpsRestrictionPolicy,arn:aws:iam::999912312399:policy/IAMRestrictionPolicy\r\n``` \r\n\r\nIf you point me in the right direction, I may be able to contribute a patch.\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\"\"\"\nimport six\nfrom cfnlint import CloudFormationLintRule\nfrom cfnlint import RuleMatch\n\n\nclass Split(CloudFormationLintRule):\n    \"\"\"Check if Split values are correct\"\"\"\n    id = 'E1018'\n    shortdesc = 'Split validation of parameters'\n    description = 'Making sure the split function is properly configured'\n    source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-split.html'\n    tags = ['functions', 'split']\n\n    def match(self, cfn):\n        \"\"\"Check CloudFormation Join\"\"\"\n\n        matches = list()\n\n        split_objs = cfn.search_deep_keys('Fn::Split')\n\n        supported_functions = [\n            'Fn::Base64',\n            'Fn::FindInMap',\n            'Fn::GetAtt',\n            'Fn::GetAZs',\n            'Fn::ImportValue',\n            'Fn::If',\n            'Fn::Join',\n            'Fn::Select',\n            'Ref'\n        ]\n\n        for split_obj in split_objs:\n            split_value_obj = split_obj[-1]\n            tree = split_obj[:-1]\n            if isinstance(split_value_obj, list):\n                if len(split_value_obj) == 2:\n                    split_delimiter = split_value_obj[0]\n                    split_string = split_value_obj[1]\n                    if not isinstance(split_delimiter, six.string_types):\n                        message = 'Split delimiter has to be of type string for {0}'\n                        matches.append(RuleMatch(\n                            tree + [0], message.format('/'.join(map(str, tree)))))\n                    if isinstance(split_string, dict):\n                        if len(split_string) == 1:\n                            for key, _ in split_string.items():\n                                if key not in supported_functions:\n                                    message = 'Split unsupported function for {0}'\n                                    matches.append(RuleMatch(\n                                        tree + [key], message.format('/'.join(map(str, tree)))))\n                        else:\n                            message = 'Split list of singular function or string for {0}'\n                            matches.append(RuleMatch(\n                                tree, message.format('/'.join(map(str, tree)))))\n                    elif not isinstance(split_string, six.string_types):\n                        message = 'Split has to be of type string or valid function for {0}'\n                        matches.append(RuleMatch(\n                            tree, message.format('/'.join(map(str, tree)))))\n                else:\n                    message = 'Split should be an array of 2 for {0}'\n                    matches.append(RuleMatch(\n                        tree, message.format('/'.join(map(str, tree)))))\n            else:\n                message = 'Split should be an array of 2 for {0}'\n                matches.append(RuleMatch(\n                    tree, message.format('/'.join(map(str, tree)))))\n        return matches\n", "path": "src/cfnlint/rules/functions/Split.py"}]}