def METHOD_NAME(self, flag_index: int, new_name: str) -> None:
    if new_name in ("", self.get_flag(flag_index).label):
        return
    labels = self.mw.col.get_config("flagLabels", {})
    labels[str(flag_index)] = self.get_flag(flag_index).label = new_name
    self.mw.col.set_config("flagLabels", labels)
    gui_hooks.flag_label_did_change()