<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_metric(self, eval_metric, labels, pre_sliced):
 """Accumulate the performance according to `eval_metric` on all devices by comparing outputs from [begin, end) to labels. By default use all outputs. Parameters eval_metric : EvalMetric The metric used for evaluation. labels : list of NDArray Typically comes from `label` of a `DataBatch`. pre_sliced : bool Whether labels are already sliced. begin : int Starting index of used outputs. end : int or None Ending index of used outputs. """

        for current_exec, (texec, islice) in enumerate(zip(self.execs, self.slices)):
            if not pre_sliced:
                labels_slice = []
                for label, axis in zip(labels, self.label_layouts):
                    if axis == 0:
                        # slicing NDArray along axis 0 can avoid copying
                        labels_slice.append(label[islice])
                    elif axis > 0:
                        # pylint: disable=no-member
                        label_my_slice = nd.slice_axis(label, axis=axis, begin=islice.start,
                                                       end=islice.stop).as_in_context(label.context)
                        # pylint: enable=no-member
                        labels_slice.append(label_my_slice)
                    else:
                        labels_slice.append(label)
            else:
                labels_slice = labels[current_exec]

            labels_ = OrderedDict(zip(self.label_names, labels_slice))
            preds = OrderedDict(zip(self.output_names, texec.outputs))
            eval_metric.update_dict(labels_, preds)