# Source code for letsencrypt_apache.display_ops

    """Contains UI methods for Apache operations."""
    import logging
    import os

    import zope.component

    from letsencrypt import errors
    from letsencrypt import interfaces

    import letsencrypt.display.util as display_util

    logger = logging.getLogger(__name__)

    def select_vhost(domain, vhosts):
        """Select an appropriate Apache Vhost.

        :param vhosts: Available Apache Virtual Hosts
        :type vhosts: :class:`list` of type `~obj.Vhost`

        :returns: VirtualHost or `None`
        :rtype: `~obj.Vhost` or `None`

        """
        if not vhosts:
            return None
        while True:
            code, tag = _vhost_menu(domain, vhosts)
            if code == display_util.HELP:
                _more_info_vhost(vhosts[tag])
            elif code == display_util.OK:
                return vhosts[tag]
            else:
                return None

    def _more_info_vhost(vhost):
        zope.component.getUtility(interfaces.IDisplay).notification(
            "Virtual Host Information:{0}{1}{0}{2}".format(
                os.linesep, "-" * (display_util.WIDTH - 4), str(vhost)),
            height=display_util.HEIGHT)