code: def convert_to_nb_cell(cell):
      """
      Convert some cell (either just code or tuple (code, output)) to a proper notebook cell.
      """
      nb_cell = {
          "cell_type": "code",
          "execution_count": None,
          "metadata": {},
      }
      if isinstance(cell, tuple):
          nb_cell["source"] = cell[0]
          nb_cell["outputs"] = [
              nbformat.notebooknode.NotebookNode(
                  {
                      "data": {"text/plain": cell[1]},
                      "execution_count": None,
                      "metadata": {},
                      "output_type": "execute_result",
                  }
              )
          ]
      else:
          nb_cell["source"] = cell
          nb_cell["outputs"] = []
      return nbformat.notebooknode.NotebookNode(nb_cell)
  
file_path: hf-course/utils/generate_notebooks.py
imports: import argparse
  import os
  import re
  import nbformat
  import shutil
  import yaml
  from pathlib import Path
label_desc: Use image node_id 3 for calling a global function with example usage: convert_to_nb_cell(cell) and returns: nbformat