code: def title_heading(cells):
      """
      The first cell should be the title (and only the title), so that the "cloud runner" cell appears
      immediately after it.
      """
      first = cells[0]
      if not isinstance(first, MarkdownCell):
          source = cell_source(first)
          # slice (not index) to handle an empty cell
          first_line = source.splitlines()[:1]
          lines = number_lines(first_line, 1)
  
          raise FormattingError(
              f"The first cell should be a markdown cell (containing only a title, like `# ...`, and optionally a summary, like `> ...`). This one seems to be a code cell. First line of the cell:\n\n{lines}"
          )
  
      elems = list(direct_children(first.ast))
      title_idx = index_of_first(elems, is_title)
  
      if title_idx is None:
          # no title at at all
          raise FormattingError(
              message_with_line(
                  first,
                  "The first cell should be just the title for the notebook (like `# ...`) optionally followed by a summary (like `> ...`), but the title seems to be missing here",
              )
          )
  
      if len(elems) == 1:
          # all good, only element is a title
          return
  
      if (
          len(elems) == 2
          and title_idx == 0
          and is_block_quote(elems[1])
      ):
          # all good, '# title' followed by '> summary'
          return
  
      # have a title, but there's other things too.
      sourcepos = surrounding_sourcepos(elems, title_idx)
  
      raise FormattingError(
          message_with_line(
              first,
              "The first cell should contain only the title (like `# ...`) optionally followed by a summary (like `> ...`) for the notebook. Additional introductory content can be in a separate following cell",
              sourcepos=sourcepos,
          )
      )
  
imports: import argparse
  import commonmark
  import nbformat
  import os
  import re
  import subprocess
  import sys
  import textwrap
  from pathlib import Path
label_desc: Use image node_id 18 for calling a global function with example usage: title_heading(cells) without return types