def filter_traceback(tb_list):
    """Given a traceback as a list of strings, looks for common boilerplate and removes it."""

    # List of boiler plate pattern to look for, with example before each
    # The match pattern is just some string that the line needs to contain
    """
        File "asynq/async_task.py", line 169, in asynq.async_task.AsyncTask._continue
        File "asynq/async_task.py", line 237, in asynq.async_task.AsyncTask._continue_on_generator
        File "asynq/async_task.py", line 209, in asynq.async_task.AsyncTask._continue_on_generator
    """
    TASK_CONTINUE = (
        [
            "asynq.async_task.AsyncTask._continue",
            "asynq.async_task.AsyncTask._continue_on_generator",
            "asynq.async_task.AsyncTask._continue_on_generator",
        ],
        "___asynq_continue___",
    )

    """
        File "asynq/decorators.py", line 161, in asynq.decorators.AsyncDecorator.__call__
        File "asynq/futures.py", line 54, in asynq.futures.FutureBase.value
        File "asynq/futures.py", line 63, in asynq.futures.FutureBase.value
        File "asynq/futures.py", line 153, in asynq.futures.FutureBase.raise_if_error
        File "<...>/python3.6/site-packages/qcore/errors.py", line 93, in reraise
           six.reraise(type(error), error, error._traceback)
        File "<...>/python3.6/site-packages/six.py", line 693, in reraise
           raise value
    """
    FUTURE_BASE = (
        [
            "asynq.decorators.AsyncDecorator.__call__",
            "asynq.futures.FutureBase.value",
            "asynq.futures.FutureBase.value",
            "asynq.futures.FutureBase.raise_if_error",
            "reraise",
            "six.reraise",
            "reraise",
            "value",
        ],
        "___asynq_future_raise_if_error___",
    )

    """
        File "asynq/decorators.py", line 153, in asynq.decorators.AsyncDecorator.asynq
        File "asynq/decorators.py", line 203, in asynq.decorators.AsyncProxyDecorator._call_pure
        File "asynq/decorators.py", line 203, in asynq.decorators.AsyncProxyDecorator._call_pure
        File "asynq/decorators.py", line 204, in asynq.decorators.AsyncProxyDecorator._call_pure
        File "asynq/decorators.py", line 275, in asynq.decorators.async_call
    """
    CALL_PURE = (
        [
            "asynq.decorators.AsyncDecorator.asynq",
            "asynq.decorators.AsyncProxyDecorator._call_pure",
            "asynq.decorators.AsyncProxyDecorator._call_pure",
            "asynq.decorators.AsyncProxyDecorator._call_pure",
            "asynq.decorators.async_call",
        ],
        "___asynq_call_pure___",
    )

    REPLACEMENTS = [TASK_CONTINUE, FUTURE_BASE, CALL_PURE]

    # iterate through the lines of the traceback and replace multiline
    # segments that match one of the replacements
    output = []
    i = 0
    while i < len(tb_list):
        did_replacement = False
        # for each replacement, try checking if all lines match
        # if so, replace with the given replacement
        for (text_to_match, replacement) in REPLACEMENTS:
            matches = True
            j = 0
            while j < len(text_to_match) and (i + j) < len(tb_list):
                if text_to_match[j] not in tb_list[i + j]:
                    matches = False
                    break
                j += 1
            if matches and j == len(text_to_match):
                # formatted to match default indentation level.
                output.append("  " + replacement + "\n")
                i = i + j
                did_replacement = True
                break
        if not did_replacement:
            output.append(tb_list[i])
            i += 1
    return output