'Find appropriate HTTP vhost for ssl_vhost.'

def _get_http_vhost(self, ssl_vhost):

    if ssl_vhost.ancestor:
        return ssl_vhost.ancestor
    candidate_http_vhs = [vhost for vhost in self.vhosts if (not vhost.ssl)]
    for http_vh in candidate_http_vhs:
        if http_vh.same_server(ssl_vhost):
            return http_vh
    for http_vh in candidate_http_vhs:
        if http_vh.same_server(ssl_vhost, generic=True):
            return http_vh
    return None
