code: def create_thumbnail(output_node: NotebookNode, filepath: Path):
      """
      Create a thumbnail for the gallery
  
      Parameters
      ----------
      output_node:
          Node containing the output image
      filepath:
          Where to save the created thumbnail on the filesystem
      """
      filepath.parent.mkdir(exist_ok=True, parents=True)
      thumb_size = THUMBNAIL_SIZE[0] * 2, THUMBNAIL_SIZE[1] * 2
      img_str = output_node["data"]["image/png"]
      file = io.BytesIO(base64.decodebytes(img_str.encode()))
      img = PIL.Image.open(file)
      img.thumbnail(thumb_size)
      img.save(filepath)
  
imports: import base64
  import io
  import itertools
  import re
  from dataclasses import dataclass
  from pathlib import Path
  from typing import Generator, Sequence
  import nbformat
  import PIL.Image
  from nbformat.notebooknode import NotebookNode
  from quartodoc.pandoc.blocks import Div
  from quartodoc.pandoc.components import Attr
  from quartodoc.pandoc.inlines import Image, Link
label_desc: Use image node_id 2 for calling a global function with example usage: create_thumbnail(output_node, filepath) without return types