docs: def delete_thumbnails(self, source_cache=None):
          """
          Delete any thumbnails generated from the source image.
  
          :arg source_cache: An optional argument only used for optimisation
            where the source cache instance is already known.
          :returns: The number of files deleted.
          """
          source_cache = self.get_source_cache()
          deleted = 0
          if source_cache:
              thumbnail_storage_hash = utils.get_storage_hash(
                  self.thumbnail_storage)
              for thumbnail_cache in source_cache.thumbnails.all():
                  # Only attempt to delete the file if it was stored using the
                  # same storage as is currently used.
                  if thumbnail_cache.storage_hash == thumbnail_storage_hash:
                      self.thumbnail_storage.delete(thumbnail_cache.name)
                      # Delete the cache thumbnail instance too.
                      thumbnail_cache.delete()
                      deleted += 1
          return deleted