def cleanpath(path):

    items = path.split('.')
    if len(items) > 1:
        path = re.sub('[^\w\.]+', '_', '_'.join(items[:-1]) + '.'
                      + ''.join(items[-1:]))
    else:
        path = re.sub('[^\w\.]+', '_', ''.join(items[-1:]))
    return path
turns any expression/path into a valid filename. replaces / with _ and
dataset/ETHPy150Open uwdata/termite-visualizations/web2py/gluon/fileutils.py/cleanpath