'Deletes previous file versions for data_usage_key.'

@classmethod
def _prune_files(cls, data_usage_key, num_to_keep=None):

    if (not config.waffle().is_enabled(config.PRUNE_OLD_VERSIONS)):
        return
    if (num_to_keep is None):
        num_to_keep = config.num_versions_to_keep()
    try:
        all_files_by_date = sorted(cls._get_all_files(data_usage_key))
        files_to_delete = (all_files_by_date[:(- num_to_keep)] if (num_to_keep > 0) else all_files_by_date)
        cls._delete_files(files_to_delete)
        log.info(u'BlockStructure:    Deleted    %d    out    of    total    %d    files    in    store;    data_usage_key:    %s,    num_to_keep:    %d.', len(files_to_delete), len(all_files_by_date), data_usage_key, num_to_keep)
    except Exception:
        log.exception(u'BlockStructure:    Exception    when    deleting    old    files;    data_usage_key:    %s.', data_usage_key)
