code: def sumarize_failing_examples(app, exception):
      """Collects the list of falling examples during build and prints them with the traceback
  
      Raises ValueError if there where failing examples
      """
      if exception is not None:
          return
  
      # Under no-plot Examples are not run so nothing to summarize
      if not app.config.sphinx_gallery_conf["plot_gallery"]:
          return
  
      gallery_conf = app.config.sphinx_gallery_conf
      failing_examples = set(gallery_conf["failing_examples"].keys())
      expected_failing_examples = set(
          [
              os.path.normpath(os.path.join(app.srcdir, path))
              for path in gallery_conf["expected_failing_examples"]
          ]
      )
  
      examples_expected_to_fail = failing_examples.intersection(
          expected_failing_examples
      )
      if examples_expected_to_fail:
          logger.info("Examples failing as expected:", color="brown")
          for fail_example in examples_expected_to_fail:
              logger.info("%s failed leaving traceback:", fail_example)
              logger.info(
                  gallery_conf["failing_examples"][fail_example]
              )
  
      examples_not_expected_to_fail = failing_examples.difference(
          expected_failing_examples
      )
      fail_msgs = []
      if examples_not_expected_to_fail:
          fail_msgs.append("Unexpected failing examples:")
          for fail_example in examples_not_expected_to_fail:
              fail_msgs.append(
                  fail_example
                  + " failed leaving traceback:\n"
                  + gallery_conf["failing_examples"][fail_example]
                  + "\n"
              )
  
      examples_not_expected_to_pass = (
          expected_failing_examples.difference(failing_examples)
      )
      if examples_not_expected_to_pass:
          fail_msgs.append(
              "Examples expected to fail, but not failling:\n"
              + "Please remove these examples from\n"
              + "sphinx_gallery_conf['expected_failing_examples']\n"
              + "in your conf.py file"
              "\n".join(examples_not_expected_to_pass)
          )
  
      if fail_msgs:
          raise ValueError(
              "Here is a summary of the problems encountered when "
              "running the examples\n\n"
              + "\n".join(fail_msgs)
              + "\n"
              + "-" * 79
          )
  
file_path: tensorly/doc/sphinx_ext/sphinx_gallery/gen_gallery.py
imports: from __future__ import division, print_function, absolute_import
  import codecs
  import copy
  import re
  import os
  from .None import glr_path_static
  from .None import sphinx_compatibility
  from .gen_rst import generate_dir_rst, SPHX_GLR_SIG
  from .docs_resolv import embed_code_links
  from .downloads import generate_zipfiles
label_desc: Use image node_id 7 for calling a global function with example usage: sumarize_failing_examples(app, exception) without return types