code: def _check_src_list_dups(locations, handle_dups="ignore"):
      """Check source list for duplicate source image locations.
  
      If dups are found, either ignore with warning, don't use duplicates (take the
      first one encountered), or fail.
  
      Args:
        locations: List of source image locations.
        handle_dups: One of the following strings: ignore, fail, unique.
  
      Returns:
        List of file locations.
      """
      ingore = "ignore"
      fail = "fail"
      unique = "unique"
  
      logging.info(
          "Number of images listed in source list: %d" % len(locations)
      )
  
      if handle_dups not in [ingore, fail, unique]:
          raise ValueError(
              "Unknown action for handling dups in source list."
          )
  
      if len(locations) == len(set(locations)):
          logging.debug("No duplicates in source list.")
          return locations
  
      uniques = []
      dups = set()
      seen = set()
  
      for location in locations:
          if location not in seen:
              uniques.append(location)
              seen.add(location)
          else:
              dups.add(location)
  
      if handle_dups == fail:
          raise ValueError(
              "Found duplicates in source list: %s" % ", ".join(dups)
          )
      logging.warn(
          "Found the following duplicates in source list: %s"
          % ", ".join(dups)
      )
      if handle_dups == unique:
          logging.info(
              "Found duplicates but only using %d unique entries in image "
              "source list" % len(uniques)
          )
          return uniques
      return locations
  
file_path: facets/facets_atlasmaker/atlasmaker_io.py
imports: import io
  import json
  import os
  import time
  import sys
  from absl import logging
  from PIL import Image
  import requests
  from requests.exceptions import Timeout
label_desc: Use image node_id 2 for calling a global function with example usage: _check_src_list_dups(locations, handle_dups) and returns: locations, locations, uniques