Code hygiene: pass flake8 python linter

This patch tweaks generate.py so it pass the flake8 python linter
available from pypi (pip install flake8).

I have made it to ignore tabs (W191) and lines too long (E501).

Non exhaustive list of issues fixed..

Clear out dicts:
* whitespace after '{' [E201]
* whitespace before '}' [E202]
* whitespace before ':' [E203]

* whitespace after '(' [E201]
* whitespace before ')' [E202]
* multiple spaces before operator [E221]
* statement ends with a semicolon [E703]
* expected 2 blank lines, found 1 [E302] (before def statements)
* unexpected spaces around keyword / parameter equals [E251]

* comparison != to None should be 'if cond is not None:' [E711]
* comparison == to None should be 'if cond is None:' [E711]

* Split some very long lines

Change-Id: I9d465a6f3401ab1a7b39a4e4ca8bb105b56ce548