# Buggy code
def teardown_handles(self):
    for group in self.handles["artist"].values():
        for v in group:
            v.remove()


# Traceback (TypeError)
TypeError                                 Traceback (most recent call last)
~/anaconda3/envs/tftt/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj, include, exclude)
962                 d['include'] = include
963                 d['exclude'] = exclude
--> 964                 return method(**d)
965             return None
966         else:

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/core/dimension.py in _repr_mimebundle_(self, include, exclude)
1229         combined and returned.
1230         """
-> 1231         return Store.render(self)
1232
1233

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/core/options.py in render(cls, obj)
1287         data, metadata = {}, {}
1288         for hook in hooks:
-> 1289             ret = hook(obj)
1290             if ret is None:
1291                 continue

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/ipython/display_hooks.py in pprint_display(obj)
278     if not ip.display_formatter.formatters['text/plain'].pprint:
279         return None
--> 280     return display(obj, raw_output=True)
281
282

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/ipython/display_hooks.py in display(obj, raw_output, **kwargs)
248     elif isinstance(obj, (CompositeOverlay, ViewableElement)):
249         with option_state(obj):
--> 250             output = element_display(obj)
251     elif isinstance(obj, (Layout, NdLayout, AdjointLayout)):
252         with option_state(obj):

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/ipython/display_hooks.py in wrapped(element)
140         try:
141             max_frames = OutputSettings.options['max_frames']
--> 142             mimebundle = fn(element, max_frames=max_frames)
143             if mimebundle is None:
144                 return {}, {}

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/ipython/display_hooks.py in element_display(element, max_frames)
186         return None
187
--> 188     return render(element)
189
190

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/ipython/display_hooks.py in render(obj, **kwargs)
63         renderer = renderer.instance(fig='png')
64
---> 65     return renderer.components(obj, **kwargs)
66
67

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/plotting/renderer.py in components(self, obj, fmt, comm, **kwargs)
319             plot = obj
320         else:
--> 321             plot, fmt = self._validate(obj, fmt)
322
323         widget_id = None

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/plotting/renderer.py in _validate(self, obj, fmt, **kwargs)
218         if isinstance(obj, tuple(self.widgets.values())):
219             return obj, 'html'
--> 220         plot = self.get_plot(obj, renderer=self, **kwargs)
221
222         fig_formats = self.mode_formats['fig'][self.mode]

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/plotting/renderer.py in get_plot(self_or_cls, obj, renderer)
205             init_key = tuple(v if d is None else d for v, d in
206                              zip(plot.keys[0], defaults))
--> 207             plot.update(init_key)
208         else:
209             plot = obj

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/plotting/mpl/plot.py in update(self, key)
242     def update(self, key):
243         if len(self) == 1 and ((key == 0) or (key == self.keys[0])) and not self.drawn:
--> 244             return self.initialize_plot()
245         return self.__getitem__(key)
246

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/plotting/mpl/plot.py in wrapper(self, *args, **kwargs)
41     def wrapper(self, *args, **kwargs):
42         with _rc_context(self.fig_rcparams):
---> 43             return f(self, *args, **kwargs)
44     return wrapper
45

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/plotting/mpl/element.py in initialize_plot(self, ranges)
813
814         if self.show_legend and element is not None:
--> 815             self._adjust_legend(element, axis)
816
817         return self._finalize_axis(key, element=element, ranges=ranges,

~/anaconda3/envs/tftt/lib/python3.5/site-packages/holoviews/plotting/mpl/element.py in _adjust_legend(self, overlay, axis)
773             # Ensure that artists with multiple handles are supported
774             if isinstance(handle, list): handle = tuple(handle)
--> 775             if handle and (handle not in data) and label and label not in used_labels:
776                 data[handle] = label
777                 used_labels.append(label)

TypeError: unhashable type: 'dict'
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-64-80e205839484> in <module>()
----> 1 hv.Dataset(xarr.to_dataset()).to(hv.BoxWhisker, "a", "value", ["b"]).overlay("b")

~/anaconda3/envs/tftt/lib/python3.5/site-packages/IPython/core/displayhook.py in __call__(self, result)
255             self.start_displayhook()
256             self.write_output_prompt()
--> 257             format_dict, md_dict = self.compute_format_data(result)
258             self.update_user_ns(result)
259             self.fill_exec_result(result)

~/anaconda3/envs/tftt/lib/python3.5/site-packages/IPython/core/displayhook.py in compute_format_data(self, result)
149
150         """
--> 151         return self.shell.display_formatter.format(result)
152
153     # This can be set to True by the write_output_prompt method in a subclass

~/anaconda3/envs/tftt/lib/python3.5/site-packages/IPython/core/formatters.py in format(self, obj, include, exclude)
148             return {}, {}
149
--> 150         format_dict, md_dict = self.mimebundle_formatter(obj, include=include, exclude=exclude)
151
152         if format_dict or md_dict:

TypeError: 'NoneType' object is not iterable

# Fixed code
def teardown_handles(self):
    for g in ("whiskers", "fliers", "medians", "boxes", "caps", "means"):
        for v in self.handles.get(g, []):
            v.remove()