def foldConditions(condition) :
    """Fold conditions to convert the condition of a priority element to the
    formatted string of the priority file matching the condition
    """
    # If the condition is simple
    if 'comparison' in condition :
        return condition['type'] + '.' + condition['name'] + ' ' + condition['comparison'] + ' ' + str(condition['value'])
    # If the condition is complex
    else :
        return '(' + (' ' + condition['logic'] + ' ').join([ foldConditions(c) for c in condition['list'] ]) + ')'