code: def _validate_args(
      image_dir: Union[PurePath, str],
      duplicate_map: Dict,
      filename: str,
  ) -> PurePath:
      """Argument validator for plot_duplicates() defined below.
      Return PurePath to the image directory"""
  
      image_dir = Path(image_dir)
      assert (
          image_dir.is_dir()
      ), "Provided image directory does not exist! Please provide the image directory where all files are present!"
  
      if not isinstance(duplicate_map, dict):
          raise ValueError("Please provide a valid Duplicate map!")
      if filename not in duplicate_map.keys():
          raise ValueError(
              "Please provide a valid filename present as a key in the duplicate_map!"
          )
      return image_dir
  
file_path: imagededup/imagededup/utils/plotter.py
imports: import matplotlib.gridspec
  import matplotlib.pyplot
  from matplotlib import figure
  from pathlib import Path, PurePath
  from typing import Dict, Union, List
  import numpy
  from PIL import Image
label_desc: Use image node_id 3 for calling a global function with example usage: _validate_args(image_dir, duplicate_map, filename) and returns: image_dir