code: def threshold_func(item, class_index, classes, threshold):
      """
      Threshold function.
  
      :param item: probability item
      :type item: list
      :param class_index: class index
      :type classes: int
      :param classes: ordered labels of classes
      :type classes: list
      :param threshold: threshold value
      :type threshold: float
      :return: selected class name
      """
      class_name = classes[class_index]
      if item[class_index] >= threshold:
          return class_name
      _classes = classes[:]
      _classes.remove(class_name)
      return _classes[0]
  
imports: from __future__ import division
  import sys
  import math
  import numpy
  import re
  from .pycm_param import *
  from .pycm_error import pycmMatrixError
  from warnings import warn
  from functools import wraps
label_desc: Use image node_id 30 for calling a global function with example usage: threshold_func(item, class_index, classes, threshold) and returns: _classes, class_name