code: def calc_ctrs(
      model_ctrs, binarized_features, hashed_cat_features, result
  ):
      ctr_hash = 0
      result_index = 0
  
      for i in range(len(model_ctrs.compressed_model_ctrs)):
          proj = model_ctrs.compressed_model_ctrs[i].projection
          ctr_hash = calc_hashes(
              binarized_features,
              hashed_cat_features,
              proj.transposed_cat_feature_indexes,
              proj.binarized_indexes,
          )
          for j in range(
              len(model_ctrs.compressed_model_ctrs[i].model_ctrs)
          ):
              ctr = model_ctrs.compressed_model_ctrs[i].model_ctrs[j]
              learn_ctr = model_ctrs.ctr_data.learn_ctrs[ctr.base_hash]
              ctr_type = ctr.base_ctr_type
              bucket = learn_ctr.resolve_hash_index(ctr_hash)
              if bucket is None:
                  result[result_index] = ctr.calc(0, 0)
              else:
                  if (
                      ctr_type == "BinarizedTargetMeanValue"
                      or ctr_type == "FloatTargetMeanValue"
                  ):
                      ctr_mean_history = learn_ctr.ctr_mean_history[
                          bucket
                      ]
                      result[result_index] = ctr.calc(
                          ctr_mean_history.sum, ctr_mean_history.count
                      )
                  elif (
                      ctr_type == "Counter" or ctr_type == "FeatureFreq"
                  ):
                      ctr_total = learn_ctr.ctr_total
                      denominator = learn_ctr.counter_denominator
                      result[result_index] = ctr.calc(
                          ctr_total[bucket], denominator
                      )
                  elif ctr_type == "Buckets":
                      ctr_history = learn_ctr.ctr_total
                      target_classes_count = (
                          learn_ctr.target_classes_count
                      )
                      total_count = 0
                      good_count = ctr_history[
                          bucket * target_classes_count
                          + ctr.target_border_idx
                      ]
                      for class_id in range(target_classes_count):
                          total_count += ctr_history[
                              bucket * target_classes_count + class_id
                          ]
                      result[result_index] = ctr.calc(
                          good_count, total_count
                      )
                  else:
                      ctr_history = learn_ctr.ctr_total
                      target_classes_count = (
                          learn_ctr.target_classes_count
                      )
  
                      if target_classes_count > 2:
                          good_count = 0
                          total_count = 0
                          for class_id in range(
                              ctr.target_border_idx + 1
                          ):
                              total_count += ctr_history[
                                  bucket * target_classes_count
                                  + class_id
                              ]
                          for class_id in range(
                              ctr.target_border_idx + 1,
                              target_classes_count,
                          ):
                              good_count += ctr_history[
                                  bucket * target_classes_count
                                  + class_id
                              ]
                          total_count += good_count
                          result[result_index] = ctr.calc(
                              good_count, total_count
                          )
                      else:
                          result[result_index] = ctr.calc(
                              ctr_history[bucket * 2 + 1],
                              ctr_history[bucket * 2]
                              + ctr_history[bucket * 2 + 1],
                          )
              result_index += 1
  
label_desc: Use image node_id 3 for calling a global function with example usage: calc_ctrs(model_ctrs, binarized_features, hashed_cat_features, result) without return types