code: def find_element_for(
      driver: WebDriver, model: Model, selector: str | None = None
  ) -> WebElement:
      script = (
          FIND_SCRIPT
          + """
      for (const els of find(Bokeh.index)) {
          return els[0] ?? null
      }
      return null
      """
      )
      el = driver.execute_script(script, model.id, selector)
      if el is not None:
          return el
      else:
          raise ValueError("not found")
  
imports: from __future__ import annotations
  import logging
  from typing import TYPE_CHECKING, Any, Sequence
  from selenium.webdriver.common.action_chains import ActionChains
  from selenium.webdriver.common.by import By
  from selenium.webdriver.common.keys import Keys
  from bokeh.models import Button
label_desc: Use image node_id 5 for calling a global function with example usage: find_element_for(driver, model, selector) and returns: el