<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def on_treeview_delete_selection(self, event=None):
 """Removes selected items from treeview"""


        tv = self.treeview
        selection = tv.selection()

        # Need to remove filter
        self.filter_remove(remember=True)

        toplevel_items = tv.get_children()
        parents_to_redraw = set()
        for item in selection:
            try:
                parent = ''
                if item not in toplevel_items:
                    parent = self.get_toplevel_parent(item)
                else:
                    self.previewer.delete(item)
                del self.treedata[item]
                tv.delete(item)
                self.app.set_changed()
                if parent:
                    self._update_max_grid_rc(parent)
                    parents_to_redraw.add(parent)
                self.widget_editor.hide_all()
            except tk.TclError:
                # Selection of parent and child items ??
                # TODO: notify something here
                pass
        # redraw widgets
        for item in parents_to_redraw:
            self.draw_widget(item)
        # restore filter
        self.filter_restore()