<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_error(context: RunContext) -> int: """ Runs after a sub-process exits Checks the return code; if it is different than 0, then a few things happen: - if the process was muted ("mute" is True), the process output is printed anyway - if "failure_ok" is True (default), then a SystemExist exception is raised :param context: run context :type context: _RunContext :return: process return code :rtype: int """


    if context.return_code != 0:
        if context.mute:
            context.result_buffer += f': command failed: {context.return_code}'
        else:
            context.result_buffer += f'{context.cmd_as_string}: command failed: {context.return_code}'

        _LOGGER_PROCESS.error(context.result_buffer)
        _LOGGER_PROCESS.error(repr(context))

        if not context.failure_ok:
            _exit(context)
    else:
        if context.mute:
            context.result_buffer += f': success: {context.return_code}'
        else:
            context.result_buffer += f'{context.cmd_as_string}: success: {context.return_code}'
        _LOGGER_PROCESS.info(context.result_buffer)

    return context.return_code