(CommandList
  children: [
    (C {(echo)} {(DQ ("Removing empty directories from etcd..."))})
    (FuncDef
      name: cleanup_empty_dirs
      body: 
        (BraceGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other "[")} 
                          {
                            (DQ 
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (C {(${ VSub_Name ETCDCTL)} {(ls)} {($ VSub_Number "$1")})
                                    ]
                                  )
                                left_token: <Left_CommandSub "$(">
                                spids: [64 72]
                              )
                            )
                          } {(Lit_Other "]")}
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (ForEach
                      iter_name: SUBDIR
                      iter_words: [
                        {
                          (CommandSubPart
                            command_list: 
                              (CommandList
                                children: [
                                  (Pipeline
                                    children: [
                                      (C {(${ VSub_Name ETCDCTL)} {(ls)} {(-p)} {($ VSub_Number "$1")})
                                      (C {(grep)} {(DQ (/) (Lit_Other "$"))})
                                    ]
                                    negated: False
                                  )
                                ]
                              )
                            left_token: <Left_CommandSub "$(">
                            spids: [87 106]
                          )
                        }
                      ]
                      do_arg_iter: False
                      body: 
                        (DoGroup
                          children: [(C {(cleanup_empty_dirs)} {(${ VSub_Name SUBDIR)})]
                          spids: [109 119]
                        )
                      spids: [86 -1]
                    )
                  ]
                  spids: [-1 78]
                )
              ]
              else_action: [
                (C {(echo)} {(DQ ("Removing empty key ") ($ VSub_Number "$1") (" ..."))})
                (C {(${ VSub_Name ETCDCTL)} {(rmdir)} {($ VSub_Number "$1")})
              ]
              spids: [122 143]
            )
          ]
          spids: [56]
        )
      spids: [51 55]
    )
    (While
      cond: [(C {(true)})]
      body: 
        (DoGroup
          children: [
            (C {(echo)} {(DQ ("Starting cleanup..."))})
            (C {(cleanup_empty_dirs)} {(DQ (/registry))})
            (C {(echo)} {(DQ ("Done with cleanup."))})
            (C {(sleep)} {(${ VSub_Name SLEEP_SECOND)})
          ]
          spids: [152 182]
        )
    )
  ]
)