(command.CommandList
  children: [
    (C {(set)} {(-o)} {(nounset)})
    (C {(set)} {(-o)} {(pipefail)})
    (C {(set)} {(-o)} {(errexit)})
    (command.FuncDef
      name: change-kind
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:kind)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:kind2)
                  op: Equal
                  rhs: 
                    {
                      (word_part.BracedVarSub
                        token: <VSub_Number 2>
                        suffix_op: 
                          (suffix_op.StringUnary
                            op_id: VTest_ColonHyphen
                            arg_word: {($ VSub_DollarName '$kind')}
                          )
                      )
                    }
                )
              ]
            )
            (C {(sed)} {(-r)} {(-i)} 
              {
                (DQ (s/) (${ VSub_Name kind) ('_([A-Z]+)/Id.') (${ VSub_Name kind2) (_) 
                  (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) (L) (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) (1/g)
                )
              } {(Lit_Other '*') (/) (Lit_Other '*') (.py)}
            )
            (C {(sed)} {(-r)} {(-i)} 
              {
                (DQ (s/) (${ VSub_Name kind) ('_([a-zA-Z]+)/') (${ VSub_Name kind2) (_) 
                  (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) (u) (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) (1/g)
                )
              } {(Lit_Other '*') (/) (Lit_Other '*') (.py)}
            )
          ]
        )
    )
    (command.FuncDef
      name: k2
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:kind)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:lower)
                  op: Equal
                  rhs: 
                    {
                      (word_part.BracedVarSub
                        token: <VSub_Name kind>
                        suffix_op: (suffix_op.StringUnary op_id:VOp1_DComma arg_word:{})
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:title)
                  op: Equal
                  rhs: 
                    {
                      (word_part.BracedVarSub
                        token: <VSub_Name lower>
                        suffix_op: (suffix_op.StringUnary op_id:VOp1_Caret arg_word:{})
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:replace)
                  op: Equal
                  rhs: 
                    {
                      (word_part.BracedVarSub
                        token: <VSub_Number 2>
                        suffix_op: 
                          (suffix_op.StringUnary
                            op_id: VTest_ColonHyphen
                            arg_word: {($ VSub_DollarName '$title')}
                          )
                      )
                    }
                )
              ]
            )
            (C {(sed)} {(-r)} {(-i)} 
              {(DQ (s/Id.) (${ VSub_Name kind) (_/Id.) (${ VSub_Name replace) (_/g))} {(Lit_Other '*') (/) (Lit_Other '*') (.py)}
            )
            (C {(sed)} {(-r)} {(-i)} 
              {(DQ (s/TokenKind.) (${ VSub_Name kind) (/TokenKind.) (${ VSub_Name replace) (/g))} {(Lit_Other '*') (/) (Lit_Other '*') (.py)}
            )
          ]
        )
    )
    (command.FuncDef
      name: replace
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:file)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                )
              ]
            )
            (command.WhileUntil
              keyword: <KW_While while>
              cond: [
                (command.Sentence
                  child: (C {(read)} {(pat)} {(replace)})
                  terminator: <Op_Semi ';'>
                )
              ]
              body: 
                (command.DoGroup
                  children: [
                    (C {(sed)} {(-r)} {(-i)} 
                      {(DQ (s/) (${ VSub_Name pat) (/) (${ VSub_Name replace) (/g))} {(Lit_Other '*') (/) (Lit_Other '*') (.py)}
                    )
                  ]
                )
              redirects: [
                (redir.Redir
                  op: <Redir_Less '<'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$file')}
                )
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: replace2
      body: 
        (command.BraceGroup
          children: [
            (C {(sed)} {(-r)} {(-i)} {(DQ ('s/^from core import runtime/from osh.meta import runtime/g'))} 
              {(Lit_Other '*') (/) (Lit_Other '*') (.py)}
            )
          ]
        )
    )
    (command.FuncDef
      name: trailing-ws
      body: 
        (command.BraceGroup
          children: [(C {(sed)} {(-r)} {(-i)} {(SQ <'s/[ ]+$//g'>)} {(DQ ($ VSub_At '$@'))})]
        )
    )
    (C {(DQ ($ VSub_At '$@'))})
  ]
)