code: def get_freq_weights(label_freq):
      """
      Goal is to give more weight to the classes with less samples
      so as to match the ones with the higher frequencies. We achieve this by
      dividing the total frequency by the freq of each label to calculate its weight.
      """
      total_size = 0
      for lf in label_freq.values():
          total_size += lf
      weighted_slots = {
          label: (total_size / (len(label_freq) * freq))
          for label, freq in label_freq.items()
      }
  
      return weighted_slots
  
imports: import csv
  import json
  import os
  import pickle
  import random
  import re
  import string
  from collections import Counter
  import numpy
  import torch
  from tqdm.auto import tqdm
  from nemo.utils import logging
  from nemo.utils.env_var_parsing import get_envint
label_desc: Use image node_id 25 for calling a global function with example usage: get_freq_weights(label_freq) and returns: weighted_slots