def clean_gallery_out(build_dir):
 build_image_dir = os.path.join(build_dir, '_images')
 if os.path.exists(build_image_dir):
  filelist = os.listdir(build_image_dir)
  for filename in filelist:
   if (filename.startswith('sphx_glr') and filename.endswith('png')):
    os.remove(os.path.join(build_image_dir, filename))

def clean_gallery_out ( build_dir ) : build_image_dir = os . path . join ( build_dir , '_images' ) if os . path . exists ( build_image_dir ) : filelist = os . listdir ( build_image_dir ) for filename in filelist : if ( filename . startswith ( 'sphx_glr' ) and filename . endswith ( 'png' ) ) : os . remove ( os . path . join ( build_image_dir , filename ) )
deletes images under the sphx_glr namespace in the build directory .