code: def tarjan_iter(g):
          
          ctx = TarjanContext(
                  g = g,
                  S = [],
                  S_set = set(),
                  index = {},
                  lowlink = {},
                  T = [],
                  ret = [])
          main_iter = iter(g)
          while True:
                  try:
                          v = next(main_iter)
                  except StopIteration:
                          return
                  if v not in ctx.index:
                          _tarjan_head(ctx, v)
                  while ctx.T:
                          it, inside, v, w = ctx.T.pop()
                          if inside:
                                  ctx.lowlink[v] = min(ctx.lowlink[w],
                                                          ctx.lowlink[v])
                          _tarjan_body(ctx, it, v)
                          if ctx.ret:
                                  assert len(ctx.ret) == 1
                                  yield ctx.ret.pop()
docs: Returns the strongly connected components of the graph @g
              in a topological order.
  
                  @g is the graph represented as a dictionary
                          { <vertex> : <successors of vertex> }.
  
              This function does not recurse.  It returns an iterator.