def _mp_pil_image_save(self, _mp_func, _mp_fmt, _mp_params, fp, format=None,
        **params):
    """Replacement function for PIL.Image.Image.save.  This does not change
    any functionality of the function but allows for overrides to be put in
    place.  This works around openpyxl.writer.excel.ExcelWriter._write_images
    which hardcodes image format to .png.  It also allows adding extra
    parameters such as quality.  This should be used as a base for a
    functools.partial function to expose only the same arguments to the
    rest of the program.

    Args:
        _mp_func: original function.
        _mp_fmt: format string to override with.
        _mp_params: dict of keyword arguments to override in params.
        fp: file to save to.
        format: ignored.
        **params (optional): keyword arguments passed to the image writer.
    """
    params.update(_mp_params)
    ret = _mp_func(fp, format=_mp_fmt, **params)
    # Reset file position for openpyxl 2.4.5 or it will write 0 sized images.
    if hasattr(fp, 'seek'):
        fp.seek(0)
    return ret