def trim_cache(layers=list(), styles=list()):
    names = []
    data = db.connect(os.path.join(LAYER_CACHE_PATH, 'directory.sqlite'))
    c = data.cursor()
    c.executemany('select basename from layers where slug=?', layers)
    names.extend( c.fetchall() )
    c.close()
    c = data.cursor()
    c.executemany('select basename from styles where slug=?', styles)
    names.extend( c.fetchall() )

    for name in names:
        if os.path.exists(name + '.mbtiles'):
            os.unlink(name + '.mbtiles')
        if os.path.exists(name + '.json'):
            os.unlink(name + '.json')
        if os.path.exists(name + '.wmsresults'):
            os.unlink(name + '.wmsresults')
        if os.path.exists(name + '.mml'):
            os.unlink(name + '.mml')
        if os.path.exists(name + '.xml'):
            os.unlink(name + '.xml')
        if os.path.exists(name + '.carto'):
            os.unlink(name + '.carto')
:return: A palette compatible with the PIL.
dataset/ETHPy150Open hydroshare/hydroshare2/ga_resources/drivers/__init__.py/trim_cache--crossover with--dataset/ETHPy150Open peterbrittain/asciimatics/asciimatics/screen.py/Screen.palette