code: def get_stack(self, f, t):
          
          stack = []
          if t and t.tb_frame == f:
              t = t.tb_next
          while f is not None:
              stack.append((f, f.f_lineno))
              f = f.f_back
          stack.reverse()
          i = max(0, len(stack) - 1)
          while t is not None:
              stack.append((t.tb_frame, t.tb_lineno))
              t = t.tb_next
          if f is None:
              i = max(0, len(stack) - 1)
          return stack, i
docs: Build the stack from frame and traceback