def METHOD_NAME(config, tokenizer, features, per_slot_class_logits,
                       per_slot_start_logits, per_slot_end_logits,
                       per_slot_refer_logits, ids, input_ids_unmasked, values,
                       inform, prefix, ds):
    import re
    prediction_list = []
    dialog_state = ds
    for i in range(len(ids)):
        if int(ids[i].split('-')[2]) == 0:
            dialog_state = {slot: 'none' for slot in config.dst_slot_list}
        prediction = {}
        prediction_addendum = {}
        for slot in config.dst_slot_list:
            class_logits = per_slot_class_logits[slot][i]
            start_logits = per_slot_start_logits[slot][i]
            end_logits = per_slot_end_logits[slot][i]
            refer_logits = per_slot_refer_logits[slot][i]
            input_ids = features['input_ids'][i].tolist()
            class_label_id = int(features['class_label_id'][slot][i])
            start_pos = int(features['start_pos'][slot][i])
            end_pos = int(features['end_pos'][slot][i])
            refer_id = int(features['refer_id'][slot][i])
            class_prediction = int(class_logits.argmax())
            start_prediction = int(start_logits.argmax())
            end_prediction = int(end_logits.argmax())
            refer_prediction = int(refer_logits.argmax())
            prediction['guid'] = ids[i].split('-')
            prediction['class_prediction_%s' % slot] = class_prediction
            prediction['class_label_id_%s' % slot] = class_label_id
            prediction['start_prediction_%s' % slot] = start_prediction
            prediction['start_pos_%s' % slot] = start_pos
            prediction['end_prediction_%s' % slot] = end_prediction
            prediction['end_pos_%s' % slot] = end_pos
            prediction['refer_prediction_%s' % slot] = refer_prediction
            prediction['refer_id_%s' % slot] = refer_id
            prediction['input_ids_%s' % slot] = input_ids
            if class_prediction == config.dst_class_types.index('dontcare'):
                dialog_state[slot] = 'dontcare'
            elif class_prediction == config.dst_class_types.index(
                    'copy_value'):
                input_tokens = tokenizer.convert_ids_to_tokens(
                    input_ids_unmasked[i])
                dialog_state[slot] = ' '.join(
                    input_tokens[start_prediction:end_prediction + 1])
                dialog_state[slot] = re.sub('(^| )##', '', dialog_state[slot])
            elif 'true' in config.dst_class_types and class_prediction == config.dst_class_types.index(
                    'true'):
                dialog_state[slot] = 'true'
            elif 'false' in config.dst_class_types and class_prediction == config.dst_class_types.index(
                    'false'):
                dialog_state[slot] = 'false'
            elif class_prediction == config.dst_class_types.index('inform'):
                # dialog_state[slot] = '§§' + inform[i][slot]
                if isinstance(inform[i][slot], str):
                    dialog_state[slot] = inform[i][slot]
                elif isinstance(inform[i][slot], list):
                    dialog_state[slot] = inform[i][slot][0]
            # Referral case is handled below
            prediction_addendum['slot_prediction_%s'
                                % slot] = dialog_state[slot]
            prediction_addendum['slot_groundtruth_%s' % slot] = values[i][slot]
        # Referral case. All other slot values need to be seen first in order
        # to be able to do this correctly.
        for slot in config.dst_slot_list:
            class_logits = per_slot_class_logits[slot][i]
            refer_logits = per_slot_refer_logits[slot][i]
            class_prediction = int(class_logits.argmax())
            refer_prediction = int(refer_logits.argmax())
            if 'refer' in config.dst_class_types and class_prediction == config.dst_class_types.index(
                    'refer'):
                # Only slots that have been mentioned before can be referred to.
                # One can think of a situation where one slot is referred to in the same utterance.
                # This phenomenon is however currently not properly covered in the training data
                # label generation process.
                dialog_state[slot] = dialog_state[config.dst_slot_list[
                    refer_prediction - 1]]
                prediction_addendum['slot_prediction_%s' %
                                    slot] = dialog_state[slot]  # Value update
        prediction.update(prediction_addendum)
        prediction_list.append(prediction)
    return dialog_state