code: def on_image_grid(callback):
      """register a function to be called before making an image grid.
      The callback is called with one argument:
         - params: ImageGridLoopParams - parameters to be used for grid creation. Can be modified.
      """
      add_callback(callback_map["callbacks_image_grid"], callback)
  
imports: import inspect
  import os
  from collections import namedtuple
  from typing import Optional, Any
  from fastapi import FastAPI
  from gradio import Blocks
  from modules import errors, timer
label_desc: Use image node_id 40 for calling a global function with example usage: on_image_grid(callback) without return types