# Buggy code
def html(self, obj, fmt=None, css=None, comm=True, **kwargs):
    """
    Renders plot or data structure and wraps the output in HTML.
    The comm argument defines whether the HTML output includes
    code to initialize a Comm, if the plot supplies one.
    """
    plot, fmt = self._validate(obj, fmt)
    figdata, _ = self(plot, fmt, **kwargs)
    if css is None:
        css = self.css

    if fmt in ["html", "json"]:
        return figdata
    else:
        if fmt == "svg":
            figdata = figdata.encode("utf-8")
        elif fmt == "pdf" and "height" not in css:
            _, h = self.get_size(plot)
            css["height"] = "%dpx" % (h * self.dpi * 1.15)

    if isinstance(css, dict):
        css = "; ".join("%s: %s" % (k, v) for k, v in css.items())
    else:
        raise ValueError("CSS must be supplied as Python dictionary")

    b64 = base64.b64encode(figdata).decode("utf-8")
    (mime_type, tag) = MIME_TYPES[fmt], HTML_TAGS[fmt]
    src = HTML_TAGS["base64"].format(mime_type=mime_type, b64=b64)
    html = tag.format(src=src, mime_type=mime_type, css=css)
    if comm and plot.comm is not None:
        comm, msg_handler = self.comms[self.mode]
        msg_handler = msg_handler.format(comm_id=plot.comm.id)
        return comm.template.format(
            init_frame=html, msg_handler=msg_handler, comm_id=plot.comm.id
        )
    else:
        return html


# Traceback (AttributeError)
AttributeError                            Traceback (most recent call last)
~/miniconda3/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
330                 pass
331             else:
--> 332                 return printer(obj)
333             # Finally look for special method names
334             method = get_real_method(obj, self.print_method)

~/miniconda3/lib/python3.6/site-packages/holoviews/ipython/display_hooks.py in pprint_display(obj)
257     if not ip.display_formatter.formatters['text/plain'].pprint:
258         return None
--> 259     return display(obj, raw=True)
260
261

~/miniconda3/lib/python3.6/site-packages/holoviews/ipython/display_hooks.py in display(obj, raw, **kwargs)
243     elif isinstance(obj, (HoloMap, DynamicMap)):
244         with option_state(obj):
--> 245             html = map_display(obj)
246     else:
247         return repr(obj) if raw else IPython.display.display(obj, **kwargs)

~/miniconda3/lib/python3.6/site-packages/holoviews/ipython/display_hooks.py in wrapped(element)
129         try:
130             html = fn(element,
--> 131                       max_frames=OutputSettings.options['max_frames'])
132
133             # Only want to add to the archive for one display hook...

~/miniconda3/lib/python3.6/site-packages/holoviews/ipython/display_hooks.py in map_display(vmap, max_frames)
198         return None
199
--> 200     return render(vmap)
201
202

~/miniconda3/lib/python3.6/site-packages/holoviews/ipython/display_hooks.py in render(obj, **kwargs)
59     if renderer.fig == 'pdf':
60         renderer = renderer.instance(fig='png')
---> 61     return renderer.html(obj, **kwargs)
62
63

~/miniconda3/lib/python3.6/site-packages/holoviews/plotting/renderer.py in html(self, obj, fmt, css, comm, **kwargs)
277         if comm and plot.comm is not None:
278             comm, msg_handler = self.comms[self.mode]
--> 279             msg_handler = msg_handler.format(comm_id=plot.comm.id)
280             return comm.template.format(init_frame=html,
281                                         msg_handler=msg_handler,

AttributeError: 'NoneType' object has no attribute 'format'

Out[13]:
:DynamicMap   []

# Fixed code
def html(self, obj, fmt=None, css=None, comm=True, **kwargs):
    """
    Renders plot or data structure and wraps the output in HTML.
    The comm argument defines whether the HTML output includes
    code to initialize a Comm, if the plot supplies one.
    """
    plot, fmt = self._validate(obj, fmt)
    figdata, _ = self(plot, fmt, **kwargs)
    if css is None:
        css = self.css

    if fmt in ["html", "json"]:
        return figdata
    else:
        if fmt == "svg":
            figdata = figdata.encode("utf-8")
        elif fmt == "pdf" and "height" not in css:
            _, h = self.get_size(plot)
            css["height"] = "%dpx" % (h * self.dpi * 1.15)

    if isinstance(css, dict):
        css = "; ".join("%s: %s" % (k, v) for k, v in css.items())
    else:
        raise ValueError("CSS must be supplied as Python dictionary")

    b64 = base64.b64encode(figdata).decode("utf-8")
    (mime_type, tag) = MIME_TYPES[fmt], HTML_TAGS[fmt]
    src = HTML_TAGS["base64"].format(mime_type=mime_type, b64=b64)
    html = tag.format(src=src, mime_type=mime_type, css=css)
    if comm and plot.comm is not None:
        comm, msg_handler = self.comms[self.mode]
        if msg_handler is None:
            return html
        msg_handler = msg_handler.format(comm_id=plot.comm.id)
        return comm.template.format(
            init_frame=html, msg_handler=msg_handler, comm_id=plot.comm.id
        )
    else:
        return html