<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def format_filtered_stacktrace(filter_traceback='default'):
 """ Returns the traceback as `string`. `filter_traceback` can be one of: - 'always': always filter out sacred internals - 'default': Default behaviour: filter out sacred internals if the exception did not originate from within sacred, and print just the internal stack trace otherwise - 'never': don't filter, always print full traceback - All other values will fall back to 'never'. """

    exc_type, exc_value, exc_traceback = sys.exc_info()
    # determine if last exception is from sacred
    current_tb = exc_traceback
    while current_tb.tb_next is not None:
        current_tb = current_tb.tb_next

    if filter_traceback == 'default' \
            and _is_sacred_frame(current_tb.tb_frame):
        # just print sacred internal trace
        header = ["Exception originated from within Sacred.\n"
                  "Traceback (most recent calls):\n"]
        texts = tb.format_exception(exc_type, exc_value, current_tb)
        return ''.join(header + texts[1:]).strip()
    elif filter_traceback in ('default', 'always'):
        # print filtered stacktrace
        if sys.version_info >= (3, 5):
            tb_exception = \
                tb.TracebackException(exc_type, exc_value, exc_traceback,
                                      limit=None)
            return ''.join(filtered_traceback_format(tb_exception))
        else:
            s = "Traceback (most recent calls WITHOUT Sacred internals):"
            current_tb = exc_traceback
            while current_tb is not None:
                if not _is_sacred_frame(current_tb.tb_frame):
                    tb.print_tb(current_tb, 1)
                current_tb = current_tb.tb_next
            s += "\n".join(tb.format_exception_only(exc_type,
                                                    exc_value)).strip()
            return s
    elif filter_traceback == 'never':
        # print full stacktrace
        return '\n'.join(
            tb.format_exception(exc_type, exc_value, exc_traceback))
    else:
        raise ValueError('Unknown value for filter_traceback: ' +
                         filter_traceback)