def METHOD_NAME(project: QgsProject, thumbnail_filename: Path) -> None:
    """Create a thumbnail for the project
    As from https://docs.qgis.org/3.16/en/docs/pyqgis_developer_cookbook/composer.html#simple-rendering
    Args:
        project (QgsProject)
        thumbnail_filename (Path)
    """
    logger.info("Generate project thumbnail image…")
    map_settings = QgsMapSettings()
    layer_tree = project.layerTreeRoot()
    def on_project_read(doc):
        r, _success = project.readNumEntry("Gui", "/CanvasColorRedPart", 255)
        g, _success = project.readNumEntry("Gui", "/CanvasColorGreenPart", 255)
        b, _success = project.readNumEntry("Gui", "/CanvasColorBluePart", 255)
        map_settings.setBackgroundColor(QColor(r, g, b))
        nodes = doc.elementsByTagName("mapcanvas")
        for i in range(nodes.size()):
            node = nodes.item(i)
            element = node.toElement()
            if (
                element.hasAttribute("name")
                and element.attribute("name") == "theMapCanvas"
            ):
                map_settings.readXml(node)
        map_settings.setRotation(0)
        map_settings.setTransformContext(project.transformContext())
        map_settings.setPathResolver(project.pathResolver())
        map_settings.setOutputSize(QSize(100, 100))
        map_settings.setLayers(reversed(list(layer_tree.customLayerOrder())))
        # print(f'output size: {map_settings.outputSize().width()} {map_settings.outputSize().height()}')
        # print(f'layers: {[layer.name() for layer in map_settings.layers()]}')
    project.readProject.connect(on_project_read)
    project.read(project.fileName())
    renderer = QgsMapRendererParallelJob(map_settings)
    event_loop = QEventLoop()
    renderer.finished.connect(event_loop.quit)
    renderer.start()
    event_loop.exec_()
    img = renderer.renderedImage()
    if not img.save(str(thumbnail_filename)):
        raise FailedThumbnailGenerationException(reason="Failed to save.")
    logger.info("Project thumbnail image generated!")