<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def authenticate_with_certificate_chain(reactor, base_url, client_chain, client_key, ca_cert):
 """ Create an ``IAgent`` which can issue authenticated requests to a particular Kubernetes server using a client certificate. :param reactor: The reactor with which to configure the resulting agent. :param twisted.python.url.URL base_url: The base location of the Kubernetes API. :param list[pem.Certificate] client_chain: The client certificate (and chain, if applicable) to use. :param pem.Key client_key: The private key to use with the client certificate. :param pem.Certificate ca_cert: The certificate authority to respect when verifying the Kubernetes server certificate. :return IAgent: An agent which will authenticate itself to a particular Kubernetes server and which will verify that server or refuse to interact with it. """

    if base_url.scheme != u"https":
        raise ValueError(
            "authenticate_with_certificate() makes sense for HTTPS, not {!r}".format(
                base_url.scheme
            ),
        )

    netloc = NetLocation(host=base_url.host, port=base_url.port)
    policy = ClientCertificatePolicyForHTTPS(
        credentials={
            netloc: TLSCredentials(
                chain=Chain(certificates=Certificates(client_chain)),
                key=client_key,
            ),
        },
        trust_roots={
            netloc: ca_cert,
        },
    )
    return Agent(reactor, contextFactory=policy)