code: def __compare_weight_handler__(compare, weight, weight_type):
      """
      Handle different weights validation.
  
      :param compare: Compare
      :type compare: pycm.Compare object
      :param weight: input weight
      :type weight: dict
      :param weight_type: input weight type
      :type weight_type: str
      :return: None
      """
      valid_dict = {
          "class_weight": compare.classes,
          "class_benchmark_weight": CLASS_BENCHMARK_SCORE_DICT.keys(),
          "overall_benchmark_weight": OVERALL_BENCHMARK_SCORE_DICT.keys(),
      }
      error_dict = {
          "class_weight": COMPARE_CLASS_WEIGHT_ERROR,
          "class_benchmark_weight": COMPARE_CLASS_BENCHMARK_WEIGHT_ERROR,
          "overall_benchmark_weight": COMPARE_OVERALL_BENCHMARK_WEIGHT_ERROR,
      }
      warning_dict = {
          "class_weight": COMPARE_CLASS_WEIGHT_WARNING,
          "class_benchmark_weight": COMPARE_CLASS_BENCHMARK_WEIGHT_WARNING,
          "overall_benchmark_weight": COMPARE_OVERALL_BENCHMARK_WEIGHT_WARNING,
      }
      if weight is None:
          return None
      if not isinstance(weight, dict):
          raise pycmCompareError(error_dict[weight_type])
      if set(weight.keys()) == set(valid_dict[weight_type]):
          if (
              all([isfloat(x) for x in weight.values()])
              and sum(weight.values()) != 0
          ):
              setattr(compare, weight_type, weight)
          else:
              warn(warning_dict[weight_type], RuntimeWarning)
      else:
          raise pycmCompareError(error_dict[weight_type])
  
imports: from __future__ import division
  from .pycm_error import pycmCompareError
  from .pycm_output import *
  from .pycm_util import *
  from .pycm_param import *
  from .pycm_obj import ConfusionMatrix
  import os
  import numpy
  from warnings import warn
label_desc: Use image node_id 5 for calling a global function with example usage: __compare_weight_handler__(compare, weight, weight_type) and returns: None