docs: def create_or_update(cls, course_video, file_name=None, image_data=None, generated_images=None):
          """
          Create a VideoImage object for a CourseVideo.
  
          NOTE: If `image_data` is None then `file_name` value will be used as it is, otherwise
          a new file name is constructed based on uuid and extension from `file_name` value.
          `image_data` will be None in case of course re-run and export. `generated_images` list
          contains names of images auto generated by VEDA. If an image is not already set then first
          image name from `generated_images` list will be used.
  
          Arguments:
              course_video (CourseVideo): CourseVideo instance
              file_name (str): File name of the image
              image_data (InMemoryUploadedFile): Image data to be saved.
              generated_images (list): auto generated image names
  
          Returns:
              Returns a tuple of (video_image, created).
          """
          video_image, created = cls.objects.get_or_create(course_video=course_video)
          if image_data:
              # Delete the existing image only if this image is not used by anyone else. This is necessary because
              # after a course re-run, a video in original course and the new course points to same image, So when
              # we update an image in new course and delete the existing image. This will delete the image from
              # original course as well, thus leaving video with having no image.
              if not created and VideoImage.objects.filter(image=video_image.image).count() == 1:
                  video_image.image.delete()
  
              with closing(image_data) as image_file:
                  file_name = '{uuid}{ext}'.format(uuid=uuid4().hex, ext=os.path.splitext(file_name)[1])
                  try:
                      video_image.image.save(file_name, image_file)
                  except Exception:  # pylint: disable=broad-except
                      logger.exception(
                          'VAL: Video Image save failed to storage for course_id [%s] and video_id [%s]',
                          course_video.course_id,
                          course_video.video.edx_video_id
                      )
                      raise
          else:
              if generated_images:
                  video_image.generated_images = generated_images
                  if not video_image.image.name:
                      file_name = generated_images[0]
  
              video_image.image.name = file_name
  
          video_image.save()
          return video_image, created