def AddWorkerPoolFlag(parser, hidden=False):
  """Adds a flag to send the build to a workerpool.

  Args:
    parser: The argparse parser to add the arg to.
    hidden: If true, retain help but do not display it.

  Returns:
    worker pool flag group
  """
  worker_pools = parser.add_argument_group('Worker pool only flags.')
  worker_pools.add_argument(
      '--worker-pool',
      hidden=hidden,
      help='Specify a worker pool for the build to run in. Format: '
      'projects/{project}/locations/{region}/workerPools/{workerPool}.')

  return worker_pools