def clean_filename(name):
    # The only acceptable characters are alphanumeric (in the current locale)
    # plus a period and dash.
    wordparts = re.split('[^\w\.\-]+', name)

    # Filter out empty strings at the beginning or end of the list.
    wordparts = filter(None, wordparts)

    # Make sure this is an ASCII-encoded string, not a Unicode string.
    filename = '_'.join(wordparts).encode('ascii')

    return filename
Update bandwidth usage at top level cell.
dataset/ETHPy150Open enthought/traits/traits/util/clean_strings.py/clean_filename--crossover with--dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/cells/manager.py/CellsManager.bw_usage_update_at_top