We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Validation error in CodeCommit Trigger
It appears that the validation for the CodeCommit Trigger class does not currently allow the use of any intrinsic functions for the `Events` property, and only accepts a list of hard coded values.

https://github.com/cloudtools/troposphere/blob/45582eb1d21a6cc9cfa608f626d8acbf0317f37f/troposphere/codecommit.py#L18-L32

We are trying to allow for the dynamic selection of  the values with a  parameter, but encounter errors when attempting to use a `Ref`.  A snippet of our trigger definition, and the error encountered is below:

```
repo_trigger1 = codecommit.Trigger(
            Name = Ref(trigger_1_name),
            CustomData = Ref(trigger_1_custom_data),
            DestinationArn = Ref(trigger_1_destination_arn),
            Branches = Ref(trigger_1_branches),
            Events = Ref(trigger_1_events),
        )
```
We are able to successfully generate the template when changing the `Events` assignment to:

```Events = ["all"],```

I believe we just need to check if the value is one of the Helper functions before iterating through the events.  I will try to get a fix pushed up for review.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `troposphere/codecommit.py`
Content:
```
1 # Copyright (c) 2016, Mark Peek <mark@peek.org>
2 # All rights reserved.
3 #
4 # See LICENSE file for full license.
5 
6 from . import AWSObject, AWSProperty
7 
8 
9 class Trigger(AWSProperty):
10     props = {
11         'Branches': ([basestring], False),
12         'CustomData': (basestring, False),
13         'DestinationArn': (basestring, False),
14         'Events': ([basestring], False),
15         'Name': (basestring, False),
16     }
17 
18     def validate(self):
19         valid = [
20             'all',
21             'createReference',
22             'deleteReference',
23             'updateReference',
24         ]
25         events = self.properties.get('Events')
26         if events:
27             if 'all' in events and len(events) != 1:
28                 raise ValueError('Trigger events: all must be used alone')
29             else:
30                 for e in events:
31                     if e not in valid:
32                         raise ValueError('Trigger: invalid event %s' % e)
33 
34 
35 class Repository(AWSObject):
36     resource_type = "AWS::CodeCommit::Repository"
37 
38     props = {
39         'RepositoryDescription': (basestring, False),
40         'RepositoryName': (basestring, True),
41         'Triggers': ([Trigger], False),
42     }
43
```
--- 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/troposphere/codecommit.py b/troposphere/codecommit.py
--- a/troposphere/codecommit.py
+++ b/troposphere/codecommit.py
@@ -3,7 +3,7 @@
 #
 # See LICENSE file for full license.
 
-from . import AWSObject, AWSProperty
+from . import AWSHelperFn, AWSObject, AWSProperty
 
 
 class Trigger(AWSProperty):
@@ -23,12 +23,12 @@
             'updateReference',
         ]
         events = self.properties.get('Events')
-        if events:
+        if events and not isinstance(events, AWSHelperFn):
             if 'all' in events and len(events) != 1:
                 raise ValueError('Trigger events: all must be used alone')
             else:
                 for e in events:
-                    if e not in valid:
+                    if e not in valid and not isinstance(e, AWSHelperFn):
                         raise ValueError('Trigger: invalid event %s' % e)

{"golden_diff": "diff --git a/troposphere/codecommit.py b/troposphere/codecommit.py\n--- a/troposphere/codecommit.py\n+++ b/troposphere/codecommit.py\n@@ -3,7 +3,7 @@\n #\n # See LICENSE file for full license.\n \n-from . import AWSObject, AWSProperty\n+from . import AWSHelperFn, AWSObject, AWSProperty\n \n \n class Trigger(AWSProperty):\n@@ -23,12 +23,12 @@\n             'updateReference',\n         ]\n         events = self.properties.get('Events')\n-        if events:\n+        if events and not isinstance(events, AWSHelperFn):\n             if 'all' in events and len(events) != 1:\n                 raise ValueError('Trigger events: all must be used alone')\n             else:\n                 for e in events:\n-                    if e not in valid:\n+                    if e not in valid and not isinstance(e, AWSHelperFn):\n                         raise ValueError('Trigger: invalid event %s' % e)\n", "issue": "Validation error in CodeCommit Trigger\nIt appears that the validation for the CodeCommit Trigger class does not currently allow the use of any intrinsic functions for the `Events` property, and only accepts a list of hard coded values.\r\n\r\nhttps://github.com/cloudtools/troposphere/blob/45582eb1d21a6cc9cfa608f626d8acbf0317f37f/troposphere/codecommit.py#L18-L32\r\n\r\nWe are trying to allow for the dynamic selection of  the values with a  parameter, but encounter errors when attempting to use a `Ref`.  A snippet of our trigger definition, and the error encountered is below:\r\n\r\n```\r\nrepo_trigger1 = codecommit.Trigger(\r\n            Name = Ref(trigger_1_name),\r\n            CustomData = Ref(trigger_1_custom_data),\r\n            DestinationArn = Ref(trigger_1_destination_arn),\r\n            Branches = Ref(trigger_1_branches),\r\n            Events = Ref(trigger_1_events),\r\n        )\r\n```\r\nWe are able to successfully generate the template when changing the `Events` assignment to:\r\n\r\n```Events = [\"all\"],```\r\n\r\nI believe we just need to check if the value is one of the Helper functions before iterating through the events.  I will try to get a fix pushed up for review.\n", "before_files": [{"content": "# Copyright (c) 2016, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\nfrom . import AWSObject, AWSProperty\n\n\nclass Trigger(AWSProperty):\n    props = {\n        'Branches': ([basestring], False),\n        'CustomData': (basestring, False),\n        'DestinationArn': (basestring, False),\n        'Events': ([basestring], False),\n        'Name': (basestring, False),\n    }\n\n    def validate(self):\n        valid = [\n            'all',\n            'createReference',\n            'deleteReference',\n            'updateReference',\n        ]\n        events = self.properties.get('Events')\n        if events:\n            if 'all' in events and len(events) != 1:\n                raise ValueError('Trigger events: all must be used alone')\n            else:\n                for e in events:\n                    if e not in valid:\n                        raise ValueError('Trigger: invalid event %s' % e)\n\n\nclass Repository(AWSObject):\n    resource_type = \"AWS::CodeCommit::Repository\"\n\n    props = {\n        'RepositoryDescription': (basestring, False),\n        'RepositoryName': (basestring, True),\n        'Triggers': ([Trigger], False),\n    }\n", "path": "troposphere/codecommit.py"}], "after_files": [{"content": "# Copyright (c) 2016, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\nfrom . import AWSHelperFn, AWSObject, AWSProperty\n\n\nclass Trigger(AWSProperty):\n    props = {\n        'Branches': ([basestring], False),\n        'CustomData': (basestring, False),\n        'DestinationArn': (basestring, False),\n        'Events': ([basestring], False),\n        'Name': (basestring, False),\n    }\n\n    def validate(self):\n        valid = [\n            'all',\n            'createReference',\n            'deleteReference',\n            'updateReference',\n        ]\n        events = self.properties.get('Events')\n        if events and not isinstance(events, AWSHelperFn):\n            if 'all' in events and len(events) != 1:\n                raise ValueError('Trigger events: all must be used alone')\n            else:\n                for e in events:\n                    if e not in valid and not isinstance(e, AWSHelperFn):\n                        raise ValueError('Trigger: invalid event %s' % e)\n\n\nclass Repository(AWSObject):\n    resource_type = \"AWS::CodeCommit::Repository\"\n\n    props = {\n        'RepositoryDescription': (basestring, False),\n        'RepositoryName': (basestring, True),\n        'Triggers': ([Trigger], False),\n    }\n", "path": "troposphere/codecommit.py"}]}