<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def save_rgb_image_as_file(self, filepath, format='png', quality=90):
 """Save the current image shown in the viewer, with any overlaid graphics, in a file with the specified format and quality. This can be overridden by subclasses. Parameters filepath : str path of the file to write format : str See :meth:`get_rgb_image_as_buffer`. quality: int See :meth:`get_rgb_image_as_buffer`. """

        with open(filepath, 'wb') as out_f:
            self.get_rgb_image_as_buffer(output=out_f, format=format,
                                         quality=quality)
        self.logger.debug("wrote %s file '%s'" % (format, filepath))