<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _parse_out_batch(cmd_array):
 """Find patterns that match to `out_batch_pat` and replace them into `STDOUT` or `TMPFILE`. :param cmd_array: `shlex.split`-ed command :rtype: ([cmd_array], batch_from_file) :returns: Modified `cmd_array` and tuple to show how OUT_BATCH is instantiated (TMPFILE or STDOUT). Returned `cmd_array` drops OUT_BATCH related tokens. :raises: `IndexError` if multiple OUT_BATCH are found """

        res_cmd_array     = cmd_array[:]
        res_batch_from_file = None

        out_batch_cmdidx = BatchCommand._out_batch_cmdidx(cmd_array)
        if out_batch_cmdidx is None:
            return (res_cmd_array, res_batch_from_file)

        if out_batch_cmdidx > 0 and cmd_array[out_batch_cmdidx - 1] == '>':  # e.g. `> OUT_BATCH`
            res_batch_from_file = BatchFromFile('STDOUT')
            del res_cmd_array[out_batch_cmdidx], res_cmd_array[out_batch_cmdidx - 1]

        else:  # OUT_BATCH is TMPFILE
            res_batch_from_file = BatchFromFile('TMPFILE')
            res_cmd_array[out_batch_cmdidx]  = res_batch_from_file.tmpfile_path()

        return (res_cmd_array, res_batch_from_file)