def _parse_in_batches(cmd_array):
        """Find patterns that match to `in_batches_pat` and replace them into `STDIN` or `TMPFILE`.

        :param cmd_array: `shlex.split`-ed command
        :rtype:   ([cmd_array], ( batch_to_file, batch_to_file, ... ) )
        :returns: Modified `cmd_array` and tuple to show how each IN_BATCH is instantiated (TMPFILE or STDIN).
            Returned `cmd_array` drops IN_BATCH related tokens.
        :raises:  `IndexError` if IN_BATCHes don't have sequential ID starting from 0
        """
        res_cmd_array      = cmd_array[:]
        res_batch_to_file_s = []

        in_batches_cmdidx  = BatchCommand._in_batches_cmdidx(cmd_array)
        for batch_id, cmdidx in enumerate(in_batches_cmdidx):
            if cmdidx > 0 and cmd_array[cmdidx - 1] == '<':  # e.g. `< IN_BATCH0`
                res_batch_to_file_s.append(BatchToFile('STDIN'))
                del res_cmd_array[cmdidx], res_cmd_array[cmdidx - 1]

            else:  # IN_BATCHx is TMPFILE
                batch_to_file = BatchToFile('TMPFILE')
                res_batch_to_file_s.append(batch_to_file)
                res_cmd_array[cmdidx] = batch_to_file.tmpfile_path()

        return (res_cmd_array, tuple(res_batch_to_file_s))
Find patterns that match to `in_batches_pat` and replace them into `STDIN` or `TMPFILE`.

        :param cmd_array: `shlex.split`-ed command
        :rtype:   ([cmd_array], ( batch_to_file, batch_to_file, ... ) )
        :returns: Modified `cmd_array` and tuple to show how each IN_BATCH is instantiated (TMPFILE or STDIN).
            Returned `cmd_array` drops IN_BATCH related tokens.
        :raises:  `IndexError` if IN_BATCHes don't have sequential ID starting from 0