code: def other_headings(cells):
      """
      No other H1/titles, and no heading level skipping.
  
      Extra titles break tables of contents, and heading level skipping causes Sphinx/reStructuredText
      warnings.
      """
      # keep track of any heading level skips, but only compare to headings that are nested correctly,
      # so an invalid section heading gets flagged, and so do any subheadings within that section.
      previous_valid_heading_level = 1
      first_invalid_heading_level = None
  
      errors = []
      for cell in cells[1:]:
          if not isinstance(cell, MarkdownCell):
              continue
  
          for elem, entering in cell.ast.walker():
              # only look at headings, and only look at them once
              if not is_heading(elem) or not entering:
                  continue
  
              if is_title(elem):
                  errors.append(
                      message_with_line(
                          cell,
                          "Found another title (like `# ...`) in internal cell. Later sections should use a high level heading (like `## ...` or `### ...`)",
                          sourcepos=elem.sourcepos,
                      )
                  )
  
              if elem.level > previous_valid_heading_level + 1:
                  previous = "#" * previous_valid_heading_level
  
                  if first_invalid_heading_level is None:
                      first_invalid_heading_level = elem.level
  
                  # assume that there's only one level skip (e.g. H1, H3, H3(*), H4, H3), and that the
                  # relative levels within the invalid section are correct. This means for all H3
                  # suggest only H2, but for H4 suggest H3 too (to continue nesting within (*)).
                  levels_from_first_invalid = (
                      elem.level - first_invalid_heading_level
                  )
                  max_suggestion_level = (
                      previous_valid_heading_level
                      + levels_from_first_invalid
                      + 1
                  )
  
                  suggestions = ", ".join(
                      f"`{'#' * i} ...`"
                      for i in range(2, max_suggestion_level + 1)
                  )
                  errors.append(
                      message_with_line(
                          cell,
                          f"Found a heading H{elem.level} that skips level(s) from most recent valid heading (H{previous_valid_heading_level} `{previous} ...`). Consider using: {suggestions}",
                          sourcepos=elem.sourcepos,
                      )
                  )
              else:
                  # this was valid, so we can reset our counts
                  previous_valid_heading_level = elem.level
                  first_invalid_heading_level = None
  
      if errors:
          raise FormattingError(errors)
  
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 19 for calling a global function with example usage: other_headings(cells) without return types