code: def is_valid_vocab(vocab: Vocab) -> bool:
      
      for symbol in [C.PAD_SYMBOL, C.UNK_SYMBOL, C.BOS_SYMBOL, C.EOS_SYMBOL]:
          if symbol not in vocab:
              logger.warning("%s missing from vocabulary.", symbol)
              return False
      if vocab[C.PAD_SYMBOL] != 0:
          logger.warning("PAD_ID does not have word id 0 in vocabulary.")
          return False
      word_ids = []
      for word, word_id in vocab.items():
          word_ids.append(word_id)
      word_ids_set = set(word_ids)
      if len(word_ids_set) != len(word_ids):
          logger.warning("Duplicate word_ids in vocabulary.")
          return False
  
      expected_word_ids = set(range(0, len(vocab)))
      if expected_word_ids != word_ids_set:
          logger.warning("Not all word_ids from 0 to len(vocabulary) present in vocabulary.")
          return False
  
      return True
docs: Checks if a vocabulary is valid. We define valid as:
      1. All indices from 0 to num_words - 1 are present without duplicates.
      2. All special symbols C.PAD_SYMBOL, C.UNK_SYMBOL, C.BOS_SYMBOL, C.EOS_SYMBOL are present.
      3. PAD_ID has word id 0.