1st draft at fixing the CRLF problem
Update generator to be roughly API compatible with python3