def _ssl_cn(server_hostname):
    """
    Return the common name (fully qualified host name) from the SERVER_HOSTNAME.
    """
    host_port = server_hostname.rsplit(":", 1)

    # SERVER_HOSTNAME includes the port
    if len(host_port) == 2:
        if host_port[-1].isdigit():
            return host_port[-2]

    return server_hostname