def _set_visibility(change):
    """
    Update whether the child container is visible using the ipywidgets 6
    approah.
    """
    target_widget = change['owner']
    cached_display = target_widget._visible_layout_display
    if change['new']:
        target_widget.layout.visibility = 'visible'
        if cached_display is not None:
            target_widget.layout.display = cached_display
        target_widget._visible_layout_display = None
    else:
        target_widget.layout.visibility = 'hidden'
        target_widget._visible_layout_display = cached_display or 'flex'
        target_widget.layout.display = 'none'
