def compute_badge_message_and_color(badge):
    """Computes message and color from badge information"""
    structure = badge['structure']
    body = badge.get('body')
    if structure == 'KO':
        return 'structure invalide', 'red'
    if body == 'OK':
        return ('structure invalide', 'orange') if structure == 'WARN' else (
            'valide', 'green')
    p = (1 - badge['error-ratio']) * 100.0
    msg = 'cellules valides : {:.1f}%'.format(p)
    return (msg, 'red') if body == 'KO' else (msg, 'orange')
