def html_wrapper(writer_fun, def_start_tag='<div>', def_end_tag='</div>'):
    """
    Decorator for HTML writer functions. It wraps the
    HTML content in start and end tags.
    """
    def wrapper(log_writer, *args, **kwargs):
        """
        Calls the original function with its arguments, places
        the start tag before the function is called and closes
        the HTML with the end tag.
        """
        log_writer.send(kwargs.get('start_tag', def_start_tag))
        try:
            writer_fun(log_writer, *args, **kwargs)

        finally:
            log_writer.send(kwargs.get('end_tag', def_end_tag))

    return wrapper