def _GetBrowserPID(track):
  """Get the browser PID from a trace.

  Args:
    track: The tracing_track.TracingTrack.

  Returns:
    The browser's PID as an integer.
  """
  for event in track.GetEvents():
    if event.category != '__metadata' or event.name != 'process_name':
      continue
    if event.args['name'] == 'Browser':
      return event.pid
  raise ValueError('couldn\'t find browser\'s PID')