def METHOD_NAME(input_file_path: Path, output_file_path: Path, stdout: bool):  # type: ignore[no-untyped-def]
    with input_file_path.open() as f:
        sam_template = yaml_parse(f)  # type: ignore[no-untyped-call]
    try:
        cloud_formation_template = transform(sam_template, {}, ManagedPolicyLoader(iam_client))
        cloud_formation_template_prettified = json.dumps(cloud_formation_template, indent=1)
        if stdout:
            print(cloud_formation_template_prettified)
            return
        output_file_path.write_text(cloud_formation_template_prettified, encoding="utf-8")
        print("Wrote transformed CloudFormation template to: ", output_file_path)
    except InvalidDocumentException as e:
        error_message = reduce(lambda message, error: message + " " + error.message, e.causes, e.message)
        LOG.error(error_message)
        errors = (cause.message for cause in e.causes)
        LOG.error(errors)