def METHOD_NAME(self):
    elements = self.get_selected_elements()
    for element in elements:
        for command in find_commands(element):
            if self.options.del_commands in ('all', command.command):
                group = command.connector.getparent()
                group.getparent().remove(group)