          self.cache[frame_no] = image
          logger.trace("Added to cache. Frame no: %s", frame_no)
          logger.trace("Current cache: %s", sorted(self.cache.keys()))
  
      def write(self, filename, image):
          """ Override for specific frame writing method """
          raise NotImplementedError
  
      def pre_encode(self, image):  # pylint: disable=unused-argument,no-self-use
          """ If the writer supports pre-encoding then override this to pre-encode
              the image in lib/convert.py to speed up saving """
 
</s> remove     def pre_encode(self, image):  # pylint: disable=unused-argument,no-self-use
        """ If the writer supports pre-encoding then override this to pre-encode
            the image in lib/convert.py to speed up saving """
 </s> add     def pre_encode(self, image) -> None:  # pylint: disable=unused-argument,no-self-use
        """ Some writer plugins support the pre-encoding of images prior to saving out. As
        patching is done in multiple threads, but writing is done in a single thread, it can
        speed up the process to do any pre-encoding as part of the converter process.

        If the writer supports pre-encoding then override this to pre-encode the image in
        :module:`lib.convert` to speed up saving.

        Parameters
        ----------
        image: :class:`numpy.ndarray`
            The converted image that is to be run through the pre-encoding function

        Returns
        -------
        python function or ``None``
            If ``None`` then the writer does not support pre-encoding, otherwise return the python
            function that will pre-encode the image
        """ </s> remove     def close(self):
        """ Override for specific frame writing close methods """
 </s> add     def close(self) -> None:
        """ Override for specific converted frame writing close methods """ </s> remove     def cache_frame(self, filename, image):
        """ Add the incoming frame to the cache """
 </s> add     def cache_frame(self, filename, image) -> None:
        """ Add the incoming converted frame to the cache ready for writing out.

        Used for ffmpeg and gif writers to ensure that the frames are written out in the correct
        order.

        Parameters
        ----------
        filename: str
            The filename of the incoming frame, where the frame index can be extracted from
        image: class:`numpy.ndarray`
            The converted frame corresponding to the given filename
        """ </s> remove     def write(self, filename, image):
        """ Frames come from the pool in arbitrary order, so cache frames
            for writing out in correct order """
 </s> add     def write(self, filename: str, image) -> None:
        """ Frames come from the pool in arbitrary order, so frames are cached for writing out
        in the correct order.

        Parameters
        ----------
        filename: str
            The incoming frame filename.
        image: :class:`numpy.ndarray`
            The converted image to be written
        """ </s> remove         out_filename = "{}.{}".format(filename, self.config["format"])
 </s> add         out_filename = f"{filename}.{self.config['format']}"
    def write(self, filename: str, image) -> None:
        """ Override for specific frame writing method.

        Parameters
        ----------
        filename: str
            The incoming frame filename.
        image: :class:`numpy.ndarray`
            The converted image to be written
        """
          self.cache[frame_no] = image
          logger.trace("Added to cache. Frame no: %s", frame_no)
          logger.trace("Current cache: %s", sorted(self.cache.keys()))
  
    def write(self, filename: str, image) -> None:
        """ Override for specific frame writing method.

        Parameters
        ----------
        filename: str
            The incoming frame filename.
        image: :class:`numpy.ndarray`
            The converted image to be written
        """
    def write(self, filename: str, image) -> None:
        """ Override for specific frame writing method.

        Parameters
        ----------
        filename: str
            The incoming frame filename.
        image: :class:`numpy.ndarray`
            The converted image to be written
        """
          raise NotImplementedError
  
      def pre_encode(self, image):  # pylint: disable=unused-argument,no-self-use
          """ If the writer supports pre-encoding then override this to pre-encode
              the image in lib/convert.py to speed up saving """
keep keep keep keep replace replace keep keep keep keep keep
 ffmpeg writer: Create new filename if output pre-exists 
plugins/convert/writer/_base.py