import warnings


def update(data):
    """Update the data in place to remove deprecated properties.

    Args:
        data (dict): dictionary to be updated

    Returns:
        True if data was changed, False otherwise
    """
    changed = False

    deprecated_top_level_keys = ('arch_folder', 'lmod', 'roots', 'enable',
                                 'tcl', 'use_view')

    # Don't update when we already have a default module set
    if 'default' in data:
        if any(key in data for key in deprecated_top_level_keys):
            warnings.warn('Did not move top-level module properties into "default" '
                          'module set, because the "default" module set is already '
                          'defined')
        return changed

    default = {}

    # Move deprecated top-level keys under "default" module set.
    for key in deprecated_top_level_keys:
        if key in data:
            default[key] = data.pop(key)

    if default:
        changed = True
        data['default'] = default

    return changed