import ssl


def get_cert_from_target(target_netloc):
    """Retrieves the SSL certificate from a secure server."""
    return ssl.get_server_certificate(
        (target_netloc.hostname, target_netloc.port)
    ).encode("utf-8")