code: def _update_confidences(
      predicted_confidences: List[float],
      predicted_tags: List[Text],
      tag: Text,
      score: float,
      idx: int,
      last_idx: int,
  ) -> List[float]:
      """Update the confidence values.
  
      Set the confidence value of a tag to score value if the predicated
      tag changed.
  
      Args:
          predicted_confidences: The list of predicted confidences.
          predicted_tags: The list of predicted tags.
          tag: The tag of the entity.
          score: The score value of that tag.
          idx: The start index of the entity.
          last_idx: The end index of the entity.
  
      Returns:
          The updated list of confidences.
      """
      for i in range(idx, last_idx + 1):
          predicted_confidences[i] = (
              round(score, 2)
              if tag_without_prefix(predicted_tags[i]) != tag
              else predicted_confidences[i]
          )
      return predicted_confidences
  
imports: import logging
  import operator
  from collections import defaultdict, Counter
  from typing import List, Tuple, Text, Optional, Dict, Any, TYPE_CHECKING
  from rasa.nlu.constants import TOKENS_NAMES, BILOU_ENTITIES, BILOU_ENTITIES_GROUP, BILOU_ENTITIES_ROLE
  from rasa.shared.nlu.constants import TEXT, ENTITIES, ENTITY_ATTRIBUTE_START, ENTITY_ATTRIBUTE_END, ENTITY_ATTRIBUTE_TYPE, ENTITY_ATTRIBUTE_GROUP, ENTITY_ATTRIBUTE_ROLE, NO_ENTITY_TAG
label_desc: Use image node_id 13 for calling a global function with example usage: _update_confidences(predicted_confidences, predicted_tags, tag, score, idx, last_idx) and returns: predicted_confidences