code: def _prepare_sphx_glr_dirs(gallery_conf, srcdir):
      
      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]
  
      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 list(zip(examples_dirs, gallery_dirs))
docs: Creates necessary folders for sphinx_gallery files