code: def fill_class_weights(weights, max_id=-1):
      """
      Gets a dictionary of labels with their weights and creates a list with size of the labels filled with those weights.
      Missing labels in the dictionary would get value 1.
  
      Args:
          weights: dictionary of weights for labels, labels as keys and weights are their values
          max_id: the largest label id in the dataset, default=-1 would consider the largest label in the weights dictionary as max_id
      Returns:
          weights_list: list of weights for labels
      """
      if max_id < 0:
          max_id = 0
          for l in weights.keys():
              max_id = max(max_id, l)
  
      all_weights = [1.0] * (max_id + 1)
      for i in range(len(all_weights)):
          if i in weights:
              all_weights[i] = weights[i]
      return all_weights
  
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 27 for calling a global function with example usage: fill_class_weights(weights, max_id) and returns: all_weights