Import cleanups: Rearrange and remove unused

If we strictly follow the guideline is easy to understand the code.
Multiple cleanups

Remove unused code, use print as function, ...
Cleanup embedded HTML

This includes removal of \n and \r characters, which might affect
the output.

Includes reducing the variable assignments to simplify code and
using implicit line continuation.
Cleanup: Merge two functions

It makes the resulting function larger, but the code is easier to
follow now. Also will make easier to strip out to an external template.
Create search results using a Jinja template

Fixes #41.