[SYNC] code improvemensts, sync with core

- reorder L10N templates
- use line_separator, maxretries from config
- pep8 changes

Change-Id: I505df862821c6df8e7aa8904608a9698806bc0a1
[SYNC] Synchronize with core

- pep8 changes
- use site.code instead of site.lang as in core

Change-Id: I52290f703726165e8f72155385f80c14127d88b0
Merge changes I52290f70,I505df862

* changes:
  [SYNC] Synchronize with core
  [SYNC] code improvemensts, sync with core