If you're using Panels to display dynamic content, you might want to dynamically check whether to display the panes based on what will be shown. For example, if there is no content to show in a certain pane, you probably don't want the pane to show at all.
You may especially want to do this if your theme will do anything ugly, or just unnecessarily conspicuous, with any HTML that is wrapping empty content.
By default, the Panels / Page Manager UI doesn't provide any kind of 'hide panel if contents are empty' functionality. So here's an example of how...