def METHOD_NAME(view, setting_name, theme_path, tries=0):
    # type: (sublime.View, str, str, int) -> None
    """ Safely apply new theme as color_scheme. """
    try:
        sublime.load_resource(theme_path)
    except Exception:
        if tries >= 8:
            print(
                'GitSavvy: The theme {} is not ready to load. Maybe restart to get colored '
                'highlights.'.format(theme_path)
            )
            return
        delay = (pow(2, tries) - 1) * 10
        sublime.set_timeout_async(lambda: METHOD_NAME(view, setting_name, theme_path, tries + 1), delay)
        return
    view.settings().set(setting_name, theme_path)