Given a traceback object, it will iterate over all
    frames that do not contain the ``__traceback_hide__``
    local variable.

def iter_traceback_frames(tb):
    """
    Given a traceback object, it will iterate over all
    frames that do not contain the ``__traceback_hide__``
    local variable.
    """
    while tb:
        # support for __traceback_hide__ which is used by a few libraries
        # to hide internal frames.
        frame = tb.tb_frame
        f_locals = getattr(frame, "f_locals", {})
        if not _getitem_from_frame(f_locals, "__traceback_hide__"):
            yield frame, getattr(tb, "tb_lineno", None)
        tb = tb.tb_next