Cleanup nbconvert templates

The templates have a lot of whitespaces, some missing ones... and there is no a pythonic structure when you read the code (some indentations missing an so on...)
So, I propose a clean up of the templates... I think this PR make them more readable and easy to understand for people who want to learn to write their own templates.
Maybe I am missing some details deleting white lines, so I open this PR to discuss and review the changes.

Cheers.

Damián.