code: def get_subsections(srcdir, examples_dir, sortkey):
      """Returns the list of subsections of a gallery
  
      Parameters
      ----------
      srcdir : str
          absolute path to directory containing conf.py
  
      examples_dir : str
          path to the examples directory relative to conf.py
  
      sortkey : sortkey
  
  
      Returns
      -------
      out : list
          sorted list of gallery subsection folder names
  
      """
      subfolders = [
          subfolder
          for subfolder in os.listdir(examples_dir)
          if os.path.exists(
              os.path.join(examples_dir, subfolder, "README.txt")
          )
      ]
      base_examples_dir_path = os.path.relpath(examples_dir, srcdir)
      subfolders_with_path = [
          os.path.join(base_examples_dir_path, item)
          for item in subfolders
      ]
      sorted_subfolders = sorted(subfolders_with_path, key=sortkey)
  
      return [
          subfolders[i]
          for i in [
              subfolders_with_path.index(item)
              for item in sorted_subfolders
          ]
      ]
  
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 3 for calling a global function with example usage: get_subsections(srcdir, examples_dir, sortkey) and returns: unknown