code: def get_class_weights(y, smooth_factor=0):
      
  
      from collections import Counter
      counter = Counter(y)
  
      if smooth_factor > 0:
          p = max(counter.values()) * smooth_factor
          for k in counter.keys():
              counter[k] += p
  
      majority = max(counter.values())
  
      return {cls: float(majority / count) for cls, count in counter.items()}
docs: Returns the weights for each class based on the frequencies of the samples.
  
      Args:
          y: A list of true labels (the labels must be hashable).
          smooth_factor: A factor that smooths extremely uneven weights.
  
      Returns:
          A dictionary with the weight for each class.