def METHOD_NAME(
    producer_node_id: int,
    anonymous: bool,
    ancestry: List[str],
    has_legacy_client_message: bool = False,
    has_sa: bool = False,
) -> TaskRes:
    """Create a TaskRes for testing."""
    task_res = TaskRes(
        task_id="",
        group_id="",
        workload_id="",
        task=Task(
            producer=Node(node_id=producer_node_id, anonymous=anonymous),
            consumer=Node(node_id=0, anonymous=True),
            ancestry=ancestry,
            legacy_client_message=ClientMessage(
                disconnect_res=ClientMessage.DisconnectRes()
            )
            if has_legacy_client_message
            else None,
            sa=SecureAggregation(named_values={}) if has_sa else None,
        ),
    )
    return task_res