Troposphere is a Python library which makes it easier to write and maintain CloudFormation templates. From the README:
The troposphere library allows for easier creation of the AWS CloudFormation JSON by writing Python code to describe the AWS resources. Troposphere also includes some basic support for OpenStack resources via heat.
To facilitate catching CloudFormation or JSON errors early the library has property and type checking built into the classes.