'Returns list of virtual hosts found in the Apache configuration.
:returns: List of :class:`~certbot_apache.obj.VirtualHost`
objects found in configuration
:rtype: list'

def get_virtual_hosts(self):

    file_paths = {}
    internal_paths = defaultdict(set)
    vhs = []
    for vhost_path in list(self.parser.parser_paths):
        paths = self.aug.match(("/files%s//*[label()=~regexp('%s')]" % (vhost_path, parser.case_i('VirtualHost'))))
        paths = [path for path in paths if ('virtualhost' in os.path.basename(path).lower())]
        for path in paths:
            new_vhost = self._create_vhost(path)
            if (not new_vhost):
                continue
            internal_path = get_internal_aug_path(new_vhost.path)
            realpath = os.path.realpath(new_vhost.filep)
            if (realpath not in file_paths):
                file_paths[realpath] = new_vhost.filep
                internal_paths[realpath].add(internal_path)
                vhs.append(new_vhost)
            elif ((realpath == new_vhost.filep) and (realpath != file_paths[realpath])):
                new_vhs = []
                for v in vhs:
                    if (v.filep == file_paths[realpath]):
                        internal_paths[realpath].remove(get_internal_aug_path(v.path))
                    else:
                        new_vhs.append(v)
                vhs = new_vhs
                file_paths[realpath] = realpath
                internal_paths[realpath].add(internal_path)
                vhs.append(new_vhost)
            elif (internal_path not in internal_paths[realpath]):
                internal_paths[realpath].add(internal_path)
                vhs.append(new_vhost)
    return vhs
