An alternative solution would be to require to open `handle` in [*universal newlines*](http://docs.python.org/2/library/functions.html#open) mode.