code: def main(html, cli_profile, workspace_tmp_dir):
      assert (
          os.path.commonpath([NOTEBOOK_DIR, html]) == NOTEBOOK_DIR
      ), f"HTML notebook must be under {NOTEBOOK_DIR} but got {html}."
      rel_path = os.path.splitext(os.path.relpath(html, NOTEBOOK_DIR))[
          0
      ]
  
      if not os.path.exists(html):  # html notebook was deleted
          print(
              f"{html} does not exist. Deleting the companion source file..."
          )
          for ext in SOURCE_EXTS:
              source_path = os.path.join(
                  SOURCE_DIR, rel_path + "." + ext
              )
              if os.path.exists(source_path):
                  os.remove(source_path)
                  print(f"\tDeleted {source_path}.")
          return
  
      print(f"Generating source file for {html} under {SOURCE_DIR} ...")
  
      work_dir = os.path.join(workspace_tmp_dir, str(uuid.uuid4()))
      workspace_path = os.path.join(work_dir, rel_path)
  
      run_cli_workspace_cmd(
          cli_profile,
          ["mkdirs", os.path.join(work_dir, os.path.dirname(rel_path))],
      )
      try:
          # `-l PYTHON` is required by CLI but ignored with `-f HTML`
          # This command works for all languages in SOURCE_EXTS
          run_cli_workspace_cmd(
              cli_profile,
              [
                  "import",
                  "-o",
                  "-l",
                  "PYTHON",
                  "-f",
                  "HTML",
                  html,
                  workspace_path,
              ],
          )
          run_cli_workspace_cmd(
              cli_profile, ["export_dir", "-o", work_dir, SOURCE_DIR]
          )
      finally:
          run_cli_workspace_cmd(cli_profile, ["rm", "-r", work_dir])
  
imports: import click
  import subprocess
  import os
  import uuid
label_desc: Use image node_id 2 for calling a global function with example usage: main(html, cli_profile, workspace_tmp_dir) without return types