def METHOD_NAME():
    if plexpy.MAC_SYS_TRAY_ICON:
        plexpy.MAC_SYS_TRAY_ICON.change_tray_icons()
    if plexpy.INSTALL_TYPE == 'macos':
        if plexpy.CONFIG.LAUNCH_STARTUP:
            try:
                subprocess.Popen(['osascript',
                                  '-e', 'tell application "System Events"',
                                  '-e', 'get the name of every login item',
                                  '-e', 'if not exists login item "Tautulli" then '
                                        'make login item at end with properties '
                                        '{path:"/Applications/Tautulli.app", hidden:false}',
                                  '-e', 'end tell'])
                logger.info("Added Tautulli to MacOS login items.")
                return True
            except OSError as e:
                logger.error("Failed to add Tautulli to MacOS login items: %s", e)
                return False
        else:
            try:
                subprocess.Popen(['osascript',
                                  '-e', 'tell application "System Events"',
                                  '-e', 'get the name of every login item',
                                  '-e', 'if exists login item "Tautulli" then '
                                        'delete login item "Tautulli"',
                                  '-e', 'end tell'])
                logger.info("Removed Tautulli from MacOS login items.")
                return True
            except OSError as e:
                logger.error("Failed to remove Tautulli from MacOS login items: %s", e)
                return False
    else:
        launch_agents = os.path.join(os.path.expanduser('~'), 'Library/LaunchAgents')
        plist_file = 'com.Tautulli.Tautulli.plist'
        plist_file_path = os.path.join(launch_agents, plist_file)
        exe = sys.executable
        run_args = [arg for arg in plexpy.ARGS if arg != '--nolaunch']
        if plexpy.FROZEN:
            args = [exe] + run_args
        else:
            args = [exe, plexpy.FULL_PATH] + run_args
        plist_dict = {
            'Label': common.PRODUCT,
            'ProgramArguments': args,
            'RunAtLoad': True
        }
        if plexpy.CONFIG.LAUNCH_STARTUP:
            if not os.path.exists(launch_agents):
                try:
                    os.makedirs(launch_agents)
                except OSError:
                    return False
            with open(plist_file_path, 'wb') as f:
                try:
                    plistlib.dump(plist_dict, f)
                except AttributeError:
                    plistlib.writePlist(plist_dict, f)
                except OSError as e:
                    logger.error("Failed to create MacOS system startup plist file: %s", e)
                    return False
            logger.info("Added Tautulli to MacOS system startup launch agents.")
            return True
        else:
            try:
                if os.path.isfile(plist_file_path):
                    os.remove(plist_file_path)
                    logger.info("Removed Tautulli from MacOS system startup launch agents.")
                return True
            except OSError as e:
                logger.error("Failed to delete MacOS system startup plist file: %s", e)
                return False