code: def _prepare_sphx_glr_dirs(gallery_conf, srcdir):
      """Creates necessary folders for sphinx_gallery files"""
      examples_dirs = gallery_conf["examples_dirs"]
      gallery_dirs = gallery_conf["gallery_dirs"]
  
      if not isinstance(examples_dirs, list):
          examples_dirs = [examples_dirs]
  
      if not isinstance(gallery_dirs, list):
          gallery_dirs = [gallery_dirs]
  
      for outdir in gallery_dirs:
          if not os.path.exists(outdir):
              os.makedirs(outdir)
  
      if bool(gallery_conf["backreferences_dir"]):
          backreferences_dir = os.path.join(
              srcdir, gallery_conf["backreferences_dir"]
          )
          if not os.path.exists(backreferences_dir):
              os.makedirs(backreferences_dir)
  
      return zip(examples_dirs, gallery_dirs)
  
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 4 for calling a global function with example usage: _prepare_sphx_glr_dirs(gallery_conf, srcdir) and returns: zip