code: def main():
      parser = argparse.ArgumentParser()
      parser.add_argument(
          "--apply",
          action="store_true",
          help="Apply any suggestions made by this script",
      )
      args = parser.parse_args()
  
      curr_dir = os.path.dirname(os.path.abspath(__file__))
      output_dir = os.path.abspath(
          os.path.join(curr_dir, "../auto_examples/")
      )
  
      retval = 0
      rebuild = False
      suggestions = []
  
      #
      # Check for stale output.
      #
      for out_file in find_py_files(output_dir):
          in_file = out_file.replace("/auto_examples/", "/gallery/")
          if not os.path.isfile(in_file):
              print(
                  "%s is stale, consider removing it and its friends."
                  % in_file
              )
              for friend in get_friends(out_file):
                  suggestions.append("git rm -f %s" % friend)
              retval = 1
              continue
  
          for friend in get_friends(out_file):
              if not is_under_version_control(friend):
                  print(
                      "%s is not under version control, consider adding it."
                      % friend
                  )
                  suggestions.append("git add %s" % friend)
  
          if diff(in_file, out_file):
              print("%s is stale." % in_file)
              rebuild = True
              retval = 1
  
      gallery_dir = output_dir.replace("/auto_examples", "/gallery")
      unbuilt = list(find_unbuilt_examples(gallery_dir))
      if unbuilt:
          for u in unbuilt:
              print("%s has not been built yet" % u)
          rebuild = True
          retval = 1
  
      if rebuild:
          src_dir = os.path.abspath(os.path.join(gallery_dir, ".."))
          print("consider rebuilding the gallery:")
          print("\tmake -C %s html" % src_dir)
  
      if suggestions:
          print(
              "consider running the following commands (or rerun this script with --apply option):"
          )
          for command in suggestions:
              print("\t" + command)
  
      if args.apply:
          for command in suggestions:
              subprocess.check_call(shlex.split(command))
  
      return retval
  
file_path: gensim/docs/src/tools/check_gallery.py
imports: import argparse
  import os
  import os.path
  import re
  import sys
  import shlex
  import subprocess
label_desc: Use image node_id 6 for calling a global function with example usage: main() and returns: retval