Brace matching works when a Python function call is inside an fstring when it's all on one line: msg = f"{prefix}{pformat(resp.json().get('message'), indent=1, sort ...