def _is_event_belongs_to_branch(
    invocation_branch: Optional[str], event: Event
) -> bool:
  """Event belongs to a branch, when event.branch is prefix of the invocation branch."""
  if not invocation_branch or not event.branch:
    return True
  return invocation_branch.startswith(event.branch)
Event belongs to a branch, when event.branch is prefix of the invocation branch.
src/google/adk/flows/llm_flows/contents.py