def menu(self, message, choices, ok_label="OK", cancel_label="Cancel",
             help_label="", **unused_kwargs):
        menu_options = {
            "choices": choices,
            "ok_label": ok_label,
            "cancel_label": cancel_label,
            "help_button": bool(help_label),
            "help_label": help_label,
            "width": self.width,
            "height": self.height,
            "menu_height": self.height - 6,
        }

        # Can accept either tuples or just the actual choices
        if choices and isinstance(choices[0], tuple):
            # pylint: disable=star-args
            code, selection = self.dialog.menu(message, **menu_options)

            # Return the selection index
            for i, choice in enumerate(choices):
                if choice[0] == selection:
                    return code, i

            return code, -1

        else:
            # "choices" is not formatted the way the dialog.menu expects...
            menu_options["choices"] = [
                (str(i), choice) for i, choice in enumerate(choices, 1)
            ]
            # pylint: disable=star-args
            code, index = self.dialog.menu(message, **menu_options)

            if code == CANCEL:
                return code, -1

            return code, int(index) - 1
Display a menu.
dataset/ETHPy150Open letsencrypt/letsencrypt/certbot/display/util.py/NcursesDisplay.menu