code: def rendering_finished(self, size, frame, cairo_ctx):
          
          surface = cairo_ctx.get_target()
          if self.format == 'png':
              surface.write_to_png(self._output_file(frame))
          surface.finish()
          surface.flush()
docs: Called when CairoCanvas has rendered a bot