code: def get_image(
      location,
      request_timeout=60,
      http_max_retries=2,
      http_retry_interval=3,
  ):
      """Wrapper function that routes to appropriate utility to get image data.
  
      Args:
        location: location of source image data. This can be a URL,
                  local file location, or possibly other location types which may be
                  supported in the future. If localfile, it should be the full path
                  to the file.
        request_timeout: Timeout in seconds for file download.
        http_max_retries: Max number of attempts we will try to retrive http images
                          due to timeout errors.
        http_retry_interval: Seconds to wait between retries.
  
      Returns:
        PIL Image object.
      """
      if http_max_retries < 1:
          raise ValueError("Max retries must be 1 or greater.")
      if http_retry_interval < 0:
          raise ValueError("Retry interval must be 0 or more seconds.")
      if urlparse(location).scheme in ("http", "https"):
          # File should be downloaded from URL.
  
          # Retry if we run into timeout errors, give up otherwise.
          attempts = 0
          while attempts < http_max_retries - 1:
              try:
                  req = requests.get(
                      location, stream=True, timeout=request_timeout
                  )
                  image_data = io.BytesIO(req.raw.read())
                  return Image.open(image_data)
              except Timeout:
                  logging.debug(
                      "Timeout error while retrieving image from URL. Waiting "
                      "%d seconds before retrying" % http_retry_interval
                  )
                  time.sleep(http_retry_interval)
              except Exception:
                  raise
              attempts += 1
          # Final attempt
          req = requests.get(
              location, stream=True, timeout=request_timeout
          )
          image_data = io.BytesIO(req.raw.read())
          return Image.open(image_data)
      else:
          try:
              with tf.gfile.GFile(location) as input_file:
                  return Image.open(input_file)
          except NameError:
              return Image.open(location)
  
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 4 for calling a global function with example usage: get_image(location, request_timeout, http_max_retries, http_retry_interval) and returns: Image, Image, Image, Image