code: def _copy_binder_notebooks(app):
      
  
      gallery_conf = app.config.sphinx_gallery_conf
      gallery_dirs = gallery_conf.get('gallery_dirs')
      binder_conf = gallery_conf.get('binder')
      notebooks_dir = os.path.join(app.outdir, binder_conf.get('notebooks_dir'))
      shutil.rmtree(notebooks_dir, ignore_errors=True)
      os.makedirs(notebooks_dir)
  
      if not isinstance(gallery_dirs, (list, tuple)):
          gallery_dirs = [gallery_dirs]
  
      iterator = sphinx_compatibility.status_iterator(
          gallery_dirs, 'copying binder notebooks...', length=len(gallery_dirs))
  
      for i_folder in iterator:
          shutil.copytree(os.path.join(app.srcdir, i_folder),
                          os.path.join(notebooks_dir, i_folder),
                          ignore=_remove_ipynb_files)
docs: Copy Jupyter notebooks to the binder notebooks directory.
  
      Copy each output gallery directory structure but only including the
      Jupyter notebook files.