Thanks Eloy Lafuente, Tim Hunt and Sam Hemelryk for valuable feedback and ideas.
It outputs a tag only if the contents you pass is non-empty. Also, unit tests for the basic parts of html_writer.