Less terrible way to build policy documents in Python?

Is there an equivalent to the TF aws_iam_policy_document to construct policy documents from objects? For example, I’d like to dynamically generate the principals block below from a list of account IDs.

If I make the below multiline policy text an f-string, I can then interpolate dynamic values, but then I have to double up every curly brace in the policy to escape them.

Surely there must be a better way?

            cdktf_cdktf_provider_aws.ecr_repository_policy.EcrRepositoryPolicy(
                self,
                name + "-cross-account-access",
                repository=ecr_repo.name,
                policy='''
                    {
                    "Version": "2012-10-17",
                    "Statement": [
                        {
                        "Sid": "AllowRepositoryRead",
                        "Effect": "Allow",
                        "Principal": {
                            "AWS": [
                            "arn:aws:iam::123:root",
                            "arn:aws:iam::234:root",
                            "arn:aws:iam::456:root",
                            "arn:aws:iam::678:root",
                            "arn:aws:iam::789:root"
                            ]
                        },
                        "Action": [
                            "ecr:DescribeRepositories",
                            "ecr:GetRepositoryPolicy"
                        ]
...

self-answer:data_aws_iam_policy_document.DataAwsIamPolicyDocument

I recommend GitHub - udondan/iam-floyd: AWS IAM policy statement generator with fluent interface which is useable with CDKTF with a small wrapper.