Handle missing newline

This is needed due to Python issue 2142 (http://bugs.python.org/issue2142).
Make this work on Python 2.6