(command.CommandList
  children: [
    (C {(Id.KW_Set set)} {(-o)} {(nounset)})
    (C {(Id.KW_Set set)} {(-o)} {(pipefail)})
    (C {(Id.KW_Set set)} {(-o)} {(errexit)})
    (command.ShFunction
      name: change-kind
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Id.Lit_VarLike 'kind=') ($ Id.VSub_Number '$1')})
            (C {(local)} 
              {(Id.Lit_VarLike 'kind2=') 
                (braced_var_sub
                  token: (Token id:Id.VSub_Number val:2 span_id:86)
                  suffix_op: 
                    (suffix_op.Unary
                      op_id: Id.VTest_ColonHyphen
                      arg_word: {($ Id.VSub_DollarName '$kind')}
                    )
                )
              }
            )
            (C {(sed)} {(-r)} {(-i)} 
              {
                (DQ (s/) (${ Id.VSub_Name kind) ('_([A-Z]+)/Id.') (${ Id.VSub_Name kind2) (_) 
                  (word_part.EscapedLiteral
                    token: (Token id:Id.Lit_EscapedChar val:'\\\\' span_id:113)
                  ) (L) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\\\' span_id:115)) (1/g)
                )
              } {(Id.Lit_Star '*') (/) (Id.Lit_Star '*') (.py)}
            )
            (C {(sed)} {(-r)} {(-i)} 
              {
                (DQ (s/) (${ Id.VSub_Name kind) ('_([a-zA-Z]+)/') (${ Id.VSub_Name kind2) (_) 
                  (word_part.EscapedLiteral
                    token: (Token id:Id.Lit_EscapedChar val:'\\\\' span_id:146)
                  ) (u) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\\\' span_id:148)) (1/g)
                )
              } {(Id.Lit_Star '*') (/) (Id.Lit_Star '*') (.py)}
            )
          ]
        )
    )
    (command.ShFunction
      name: k2
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Id.Lit_VarLike 'kind=') ($ Id.VSub_Number '$1')})
            (C {(local)} 
              {(Id.Lit_VarLike 'lower=') 
                (braced_var_sub
                  token: (Token id:Id.VSub_Name val:kind span_id:177)
                  suffix_op: (suffix_op.Unary op_id:Id.VOp1_DComma arg_word:{})
                )
              }
            )
            (C {(local)} 
              {(Id.Lit_VarLike 'title=') 
                (braced_var_sub
                  token: (Token id:Id.VSub_Name val:lower span_id:187)
                  suffix_op: (suffix_op.Unary op_id:Id.VOp1_Caret arg_word:{})
                )
              }
            )
            (C {(local)} 
              {(Id.Lit_VarLike 'replace=') 
                (braced_var_sub
                  token: (Token id:Id.VSub_Number val:2 span_id:196)
                  suffix_op: 
                    (suffix_op.Unary
                      op_id: Id.VTest_ColonHyphen
                      arg_word: {($ Id.VSub_DollarName '$title')}
                    )
                )
              }
            )
            (C {(sed)} {(-r)} {(-i)} 
              {(DQ (s/Id.) (${ Id.VSub_Name kind) (_/Id.) (${ Id.VSub_Name replace) (_/g))} {(Id.Lit_Star '*') (/) (Id.Lit_Star '*') (.py)}
            )
            (C {(sed)} {(-r)} {(-i)} 
              {
                (DQ (s/TokenKind.) (${ Id.VSub_Name kind) (/TokenKind.) (${ Id.VSub_Name replace) (/g))
              } {(Id.Lit_Star '*') (/) (Id.Lit_Star '*') (.py)}
            )
          ]
        )
    )
    (command.ShFunction
      name: replace
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Id.Lit_VarLike 'file=') ($ Id.VSub_Number '$1')})
            (command.WhileUntil
              keyword: (Token id:Id.KW_While val:while span_id:271)
              cond: [
                (command.Sentence
                  child: (C {(read)} {(pat)} {(replace)})
                  terminator: (Token id:Id.Op_Semi val:';' span_id:278)
                )
              ]
              body: 
                (command.DoGroup
                  children: [
                    (C {(sed)} {(-r)} {(-i)} 
                      {(DQ (s/) (${ Id.VSub_Name pat) (/) (${ Id.VSub_Name replace) (/g))} {(Id.Lit_Star '*') (/) (Id.Lit_Star '*') (.py)}
                    )
                  ]
                )
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_Less val:'<' span_id:309)
                  fd: -1
                  arg_word: {($ Id.VSub_DollarName '$file')}
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: replace2
      body: 
        (command.BraceGroup
          children: [
            (C {(sed)} {(-r)} {(-i)} {(DQ ('s/^from core import runtime/from osh.meta import runtime/g'))} 
              {(Id.Lit_Star '*') (/) (Id.Lit_Star '*') (.py)}
            )
          ]
        )
    )
    (command.ShFunction
      name: trailing-ws
      body: 
        (command.BraceGroup
          children: [
            (C {(sed)} {(-r)} {(-i)} {(SQ (Token id:Id.Lit_Chars val:'s/[ ]+$//g' span_id:363))} 
              {(DQ ($ Id.VSub_At '$@'))}
            )
          ]
        )
    )
    (C {(DQ ($ Id.VSub_At '$@'))})
  ]
)