def replace_returns(stmts, output_var):
  """Change any returns at the outer scope into assignments to the output var"""

  new_stmts = []
  for stmt in stmts:
    c = stmt.__class__
    if c is Return:
      if output_var:
        new_stmts.append(Assign(output_var, stmt.value))
      continue
    if c is If:
      stmt.true = replace_returns(stmt.true, output_var)
      stmt.false = replace_returns(stmt.false, output_var)
    elif (ForLoop, While) in c:
      stmt.body = replace_returns(stmt.body, output_var)

    new_stmts.append(stmt)
  return new_stmts
dataset/ETHPy150Open iskandr/parakeet/parakeet/transforms/inline.py/replace_returns/swapped operands of `in`