def METHOD_NAME(target, check, target_version, log_cb=None, online=True, force=False):
    logger = logging.getLogger("octoprint.plugins.softwareupdate.updaters.update_script")
    if not online and not check("offline", False):
        raise CannotUpdateOffline()
    if not can_perform_update(target, check):
        raise ConfigurationInvalid(
            "checkout_folder and update_folder are missing for update target %s, one is needed"
            % target
        )
    update_script = check["update_script"]
    update_branch = check.get("update_branch", "")
    force_exact_version = check.get("force_exact_version", False)
    folder = check.get(
        "update_folder", check.get("checkout_folder")
    )  # either should be set, tested above
    pre_update_script = check.get("pre_update_script", None)
    post_update_script = check.get("post_update_script", None)
    caller = _get_caller(log_cb=log_cb)
    ### pre update
    if pre_update_script is not None:
        logger.debug(f"Target: {target}, running pre-update script: {pre_update_script}")
        try:
            caller.checked_call(pre_update_script, cwd=folder)
        except CommandlineError as e:
            logger.exception(
                "Target: %s, error while executing pre update script, got returncode %r"
                % (target, e.returncode)
            )
    ### update
    try:
        update_command = update_script.format(
            python=sys.executable,
            folder=folder,
            target=target_version,
            branch=update_branch,
            force="true" if force_exact_version else "false",
        )
        logger.debug(f"Target {target}, running update script: {update_command}")
        caller.checked_call(update_command, cwd=folder)
    except CommandlineError as e:
        logger.exception(
            "Target: %s, error while executing update script, got returncode %r"
            % (target, e.returncode)
        )
        raise UpdateError(
            "Error while executing update script for %s", (e.stdout, e.stderr)
        )
    ### post update
    if post_update_script is not None:
        logger.debug(
            "Target: {}, running post-update script {}...".format(
                target, post_update_script
            )
        )
        try:
            caller.checked_call(post_update_script, cwd=folder)
        except CommandlineError as e:
            logger.exception(
                "Target: %s, error while executing post update script, got returncode %r"
                % (target, e.returncode)
            )
    return "ok"