def METHOD_NAME(gdir, dem_source=None, keep_dem_folders=False):
    """Select a DEM from the ones available in an RGI-TOPO glacier directory.
    Parameters
    ----------
    gdir : :py:class:`oggm.GlacierDirectory`
        the glacier directory
    dem_source : str
        the source to pick from. If 'RGI', we assume that there is a
        `dem_source` attribute in the RGI file.
    keep_dem_folders : bool
        the default is to delete the other DEM directories to save space.
        Set this to True to prevent that (e.g. for sensitivity tests)
    """
    # Start by deleting noise
    for fn in os.listdir(gdir.dir):
        if fn in ['glacier_mask.tif', 'glacier_grid.json',
                  'outlines.tar.gz', 'intersects.tar.gz']:
            continue
        fn = os.path.join(gdir.dir, fn)
        if os.path.isfile(fn):
            os.remove(fn)
    if dem_source == 'RGI':
        dem_source = gdir.rgi_dem_source
    sources = [f.name for f in os.scandir(gdir.dir) if f.is_dir()
               and not f.name.startswith('.')]
    if dem_source not in sources:
        raise RuntimeError('source {} not in folder'.format(dem_source))
    gdir.add_to_diagnostics('dem_source', dem_source)
    shutil.copyfile(os.path.join(gdir.dir, dem_source, 'dem.tif'),
                    gdir.get_filepath('dem'))
    shutil.copyfile(os.path.join(gdir.dir, dem_source, 'dem_source.txt'),
                    gdir.get_filepath('dem_source'))
    if not keep_dem_folders:
        for source in sources:
            shutil.rmtree(os.path.join(gdir.dir, source))