def METHOD_NAME(self, text, remove_preceding_separator=True):
    for idx, m in enumerate(self.entries):
        if not isinstance(m, MenuEntry):
            continue
        if m.caption == text:
            self.entries.remove(m)
            if remove_preceding_separator:
                self.entries.pop(idx - 1)