def METHOD_NAME(benchmark_spec):
  """Snapshot Pub/Sub input subscription to later restore at end of test."""
  suffix = ''.join(
      random.choice(string.ascii_lowercase + string.digits) for i in range(6))
  benchmark_spec.input_subscription_name = (
      FLAGS.dpb_dataflow_template_input_subscription.split('/')[-1])
  benchmark_spec.input_subscription_snapshot_name = (
      f'{benchmark_spec.input_subscription_name}-{suffix}')
  cmd = util.GcloudCommand(None, 'pubsub', 'snapshots', 'create',
                           benchmark_spec.input_subscription_snapshot_name)
  cmd.flags = {
      'project': util.GetDefaultProject(),
      'subscription': benchmark_spec.input_subscription_name,
      'format': 'json',
  }
  stdout, _, _ = cmd.Issue()
  snapshot_id = json.loads(stdout)[0]['snapshotId']
  logging.info('Prepare: Created snapshot %s for input subscription data',
               snapshot_id)