code: def get_media_with_naming (output_dir, media_url, uuid, size):
      
      try:
          response = requests.get(media_url, stream=True)
          response.raise_for_status()
      except (requests.exceptions.HTTPError, requests.exceptions.ConnectionError) as e:
          print('*** HTTP ERROR: {0}'.format(e))
          return False
  
      ### iDigBio returns 200 OK and displays an SVG status image when a derivative
      ### is not present.  Check for "Content-Type: image/svg+xml" header to notice this condition.
      if response.headers['Content-Type'] == 'image/svg+xml':
          print("*** WARNING - No media at '{0}'".format(media_url))
          return False
  
      # Output filenames will be of the form: {mediarecord_uuid}_{SIZE}.jpg
      local_filepath = os.path.join(output_dir,  uuid + '_' + SIZE + '.jpg')
  
      try:
          with open(local_filepath, 'wb') as out_file:
              shutil.copyfileobj(response.raw, out_file)
          return True
      except:
          return False
docs: Download a media file to a directory and name it based on the input parameters.
  
   'output_dir' controls where the download is placed.
  
   'media_url' is the url / link to the media that will be downloaded.
  
   'uuid' is used to uniquely identify the output filename.
  
   'SIZE' is the class of image derivative, useful in the output filename.