def _get_macos_osascript_command(commands: List[str]) -> List[str]:
        """
        Inspired by
        https://github.com/barneygale/elevate/blob/01263b690288f022bf6fa702711ac96816bc0e74/elevate/posix.py
        Wraps the given commands in a macOS osascript command to prompt for root permissions.
        """
        from shlex import quote

        def quote_shell(args):
            return " ".join(quote(arg) for arg in args)

        def quote_applescript(string):
            charmap = {
                "\n": "\\n",
                "\r": "\\r",
                "\t": "\\t",
                "\"": "\\\"",
                "\\": "\\\\",
            }
            return '"%s"' % "".join(charmap.get(char, char) for char in string)

        commands = [
            "osascript",
            "-e",
            "do shell script %s "
            "with administrator privileges "
            "without altering line endings"
            % quote_applescript(quote_shell(commands))
        ]
        return commands

        Inspired by
        https://github.com/barneygale/elevate/blob/01263b690288f022bf6fa702711ac96816bc0e74/elevate/posix.py
        Wraps the given commands in a macOS osascript command to prompt for root permissions.
        
electrum/plugin.py