Fix compatibility with Python 3 using dict.items() instead of dict.iteritems()
Merge branch 'issue312' into feat_includecode_templating