def transform_diag_element(element, file_ids_to_remove, new_file_ids):
    """
    This function will update every file attribute of the given diagnostic
    element.
    On the first call it will get a diagnostic section dictionary and
    recursively traverse all children of it. If the child element is a file
    attribute it will update it by using the 'new_file_ids' dictionary.

    It will return False if one of the file attribute is in the removable file
    list. Otherwise it will return True.
    """
    if isinstance(element, dict):
        for k, v in element.items():
            if k == 'file':
                if v in file_ids_to_remove:
                    return False
                else:
                    element['file'] = new_file_ids[v]
            else:
                if not transform_diag_element(v, file_ids_to_remove,
                                              new_file_ids):
                    return False
    elif isinstance(element, list) or isinstance(element, tuple):
        for v in element:
            if not transform_diag_element(v, file_ids_to_remove, new_file_ids):
                return False

    return True