(command.CommandList
  children: [
    (C {<set>} {<-o>} {<nounset>})
    (C {<set>} {<-o>} {<pipefail>})
    (C {<set>} {<-o>} {<errexit>})
    (command.ShFunction
      name: change-kind
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (C {<local>} {<Id.Lit_VarLike 'kind='> ($ Id.VSub_Number 1)})
            (C {<local>} 
              {<Id.Lit_VarLike 'kind2='> 
                (braced_var_sub
                  left: <Id.Left_DollarBrace '${'>
                  token: <Id.VSub_Number 2>
                  var_name: 2
                  suffix_op: 
                    (suffix_op.Unary
                      op: <Id.VTest_ColonHyphen _>
                      arg_word: {($ Id.VSub_DollarName kind)}
                    )
                  right: <Id.Right_DollarBrace '}'>
                )
              }
            )
            (C {<sed>} {<-r>} {<-i>} 
              {
                (DQ <'s/'> (${ Id.VSub_Name kind) <'_([A-Z]+)/Id.'> (${ Id.VSub_Name kind2) <_> 
                  (word_part.EscapedLiteral
                    token: <Id.Lit_EscapedChar '\\\\'>
                    ch: '\\'
                  ) <L> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'> ch:'\\') <'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: <Id.Lit_EscapedChar '\\\\'>
                    ch: '\\'
                  ) <u> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'> ch:'\\') <'1/g'>
                )
              } {<Id.Lit_Star '*'> <'/'> <Id.Lit_Star '*'> <.py>}
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: k2
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (C {<local>} {<Id.Lit_VarLike 'kind='> ($ Id.VSub_Number 1)})
            (C {<local>} 
              {<Id.Lit_VarLike 'lower='> 
                (braced_var_sub
                  left: <Id.Left_DollarBrace '${'>
                  token: <Id.VSub_Name kind>
                  var_name: kind
                  suffix_op: (suffix_op.Unary op:<Id.VOp1_DComma ',,'> arg_word:{})
                  right: <Id.Right_DollarBrace '}'>
                )
              }
            )
            (C {<local>} 
              {<Id.Lit_VarLike 'title='> 
                (braced_var_sub
                  left: <Id.Left_DollarBrace '${'>
                  token: <Id.VSub_Name lower>
                  var_name: lower
                  suffix_op: (suffix_op.Unary op:<Id.VOp1_Caret '^'> arg_word:{})
                  right: <Id.Right_DollarBrace '}'>
                )
              }
            )
            (C {<local>} 
              {<Id.Lit_VarLike 'replace='> 
                (braced_var_sub
                  left: <Id.Left_DollarBrace '${'>
                  token: <Id.VSub_Number 2>
                  var_name: 2
                  suffix_op: 
                    (suffix_op.Unary
                      op: <Id.VTest_ColonHyphen _>
                      arg_word: {($ Id.VSub_DollarName title)}
                    )
                  right: <Id.Right_DollarBrace '}'>
                )
              }
            )
            (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>}
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: replace
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (C {<local>} {<Id.Lit_VarLike 'file='> ($ Id.VSub_Number 1)})
            (command.WhileUntil
              keyword: <Id.KW_While while>
              cond: 
                (condition.Shell
                  commands: [
                    (command.Sentence
                      child: (C {<read>} {<pat>} {<replace>})
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
              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
                  op: <Id.Redir_Less '<'>
                  loc: (redir_loc.Fd fd:0)
                  arg: {($ Id.VSub_DollarName file)}
                )
              ]
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: replace2
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (C {<sed>} {<-r>} {<-i>} {(DQ <'s/^from core import runtime/from osh.meta import runtime/g'>)} 
              {<Id.Lit_Star '*'> <'/'> <Id.Lit_Star '*'> <.py>}
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: trailing-ws
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [(C {<sed>} {<-r>} {<-i>} {(SQ <'s/[ ]+$//g'>)} {(DQ ($ Id.VSub_At '@'))})]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (C {(DQ ($ Id.VSub_At '@'))})
  ]
)