def switch_visibility(widget, visibility):
    """
    Display/hide a widget with CSS.
    """
    if visibility:
        widget.remove_class('invisible')
        widget.add_class('visible')
    else:
        widget.remove_class('visible')
        widget.add_class('invisible')
