def METHOD_NAME(cls, scene):
    buffer = QBuffer()
    generator = QSvgGenerator()
    generator.setOutputDevice(buffer)
    scene_rect = scene.sceneRect()
    generator.setViewBox(scene_rect)
    painter = QPainter(generator)
    scene.render(painter, scene_rect, scene_rect)
    painter.end()
    buffer.open(QBuffer.ReadOnly)
    renderer = cls(buffer.readAll())
    buffer.close()
    renderer.scene = scene
    return renderer