code: def _out_batch_cmdidx(cmd_array):
          
          out_batch_cmdidx = None
          for cmdidx, tok in enumerate(cmd_array):
              mat = BatchCommand.out_batch_pat.match(tok)
              if mat:
                  if out_batch_cmdidx:
                      raise IndexError(
                          'OUT_BATCH is used multiple times in command below:%s$ %s' %
                          (os.linesep, list2cmdline(cmd_array)))
                  out_batch_cmdidx = cmdidx
          return out_batch_cmdidx
docs: Raise `IndexError` if OUT_BATCH is used multiple time
  
          :returns: OUT_BATCH cmdidx (None if OUT_BATCH is not in `cmd_array`)
              $ cat a.txt > OUT_BATCH => 3