def METHOD_NAME(path: Path, name: str):
    """Generate a keypair. If the keypair exists, return that instead.
    https://jwcrypto.readthedocs.io/en/stable/jwk.html
    """
    private_path = path / f"{name}.private.json"
    public_path = path / f"{name}.public.json"
    if private_path.exists():
        print(f"keys for {name} already exist, loading from file")
        with private_path.open("r") as fp:
            data = json.load(fp)
        return jwk.JWK(**data)
    else:
        key = jwk.JWK.generate(kty="EC")
        with (private_path).open("w") as fp:
            write_serialized(key.export_private(), fp)
        with (public_path).open("w") as fp:
            write_serialized(key.export_public(), fp)
        return key