code: def execute_nb(
      src, dst, allow_errors=False, timeout=1000, kernel_name=None
  ):
      """
      Execute notebook in `src` and write the output to `dst`
  
      Parameters
      ----------
      src, dst: str
          path to notebook
      allow_errors: bool
      timeout: int
      kernel_name: str
          defualts to value set in notebook metadata
  
      Returns
      -------
      dst: str
      """
      with open(src, encoding="utf-8") as f:
          nb = nbformat.read(f, as_version=4)
  
      ep = ExecutePreprocessor(
          allow_errors=False, timeout=timeout, kernel_name=kernel_name
      )
      ep.preprocess(nb, {"metadata": {"path": SOURCE_DIR}})
  
      with open(dst, "w", encoding="utf-8") as f:
          nbformat.write(nb, f)
      return dst
  
file_path: statsmodels/tools/nbgenerate.py
imports: import argparse
  import asyncio
  from functools import partial
  import hashlib
  import json
  import os
  import shutil
  import sys
  from colorama import Fore, init
  from nbconvert import HTMLExporter, RSTExporter
  from nbconvert.preprocessors import ExecutePreprocessor
  import nbformat
label_desc: Use image node_id 1 for calling a global function with example usage: execute_nb(src, dst, allow_errors, timeout, kernel_name) and returns: dst