def create_client_certificate(client, cluster, csr):
    """Create and get a certificate for the given Magnum cluster.

    Args:
        client (MagnumV1Client): the Magnum client to use to connect to the Magnum
            service.
        cluster (krake.data.openstack.MagnumCluster): the Magnum cluster for which a
            kubeconfig file will be created.
        csr (str): the certificate signing request (CSR) to use on the Magnum service
            for the creation of the certificate.

    Returns:
        str: the generated certificate.

    """
    return client.certificates.create(
        cluster_uuid=cluster.status.cluster_id, csr=csr
    ).pem