code: def _get_image_urls_for_pageids(page_ids):
      """Return a list of image urls associated with the given page ids.
  
      Note that the limit per request by default via the API is 50.
  
      Args:
        pageids: List of wikipedia page ids.
      """
      # Concat page ids into a single string
      page_ids_concat = "|".join([str(x) for x in page_ids])
  
      image_urls = []
  
      # Query params.
      payload = {
          "action": "query",
          "iiprop": "url",
          "prop": "imageinfo",
          "format": "json",
          "pageids": page_ids_concat,
      }
      r = requests.get(BASE_API_URL, params=payload)
      logging.debug("Connecting to url: %s" % r.url)
      response_data = r.json()
  
      try:
          pages_dict = response_data["query"]["pages"]
      except KeyError:
          raise KeyError(
              "Unable to find the required elements when retrieving "
              "image URLs from response. See message: %s"
              % response_data
          )
      for pageid_key in pages_dict:
          images = pages_dict[pageid_key]["imageinfo"]
          for imageinfo_obj in images:
              image_urls.append(imageinfo_obj["url"])
  
      return image_urls
  
file_path: facets/facets_atlasmaker/utils/wikipedia_sourcelist_generator.py
imports: import csv
  import os
  from absl import app
  from absl import flags
  from absl import logging
  import requests
label_desc: Use image node_id 2 for calling a global function with example usage: _get_image_urls_for_pageids(page_ids) and returns: image_urls