code: def get_closest(
      target_word: str,
      word_to_idx: Dict,
      embeddings: torch.Tensor,
      n: int = 5,
  ) -> List[Tuple[str, torch.Tensor]]:
      """
      Get the n closest
      words to your word.
      """
  
      # Calculate distances to all other words
  
      word_embedding = embeddings[word_to_idx[target_word.lower()]]
      distances = []
      for word, index in word_to_idx.items():
          if word == "<MASK>" or word == target_word:
              continue
          distances.append(
              (word, torch.dist(word_embedding, embeddings[index]))
          )
  
      results = sorted(distances, key=lambda x: x[1])[1 : n + 2]
      return results
  
imports: from typing import Dict, List, Tuple
  import torch
label_desc: Use image node_id 2 for calling a global function with example usage: get_closest(target_word, word_to_idx, embeddings, n) and returns: results