def METHOD_NAME(argv=None):
  """Main entry point."""
  parser = argparse.ArgumentParser()
  parser.add_argument(
      '--kind', dest='kind', default='writereadtest', help='Datastore Kind')
  parser.add_argument(
      '--num_entities',
      dest='num_entities',
      type=int,
      required=True,
      help='Number of entities to write')
  parser.add_argument(
      '--limit',
      dest='limit',
      type=int,
      help='Limit of number of entities to write')
  known_args, pipeline_args = parser.parse_known_args(argv)
  pipeline_options = PipelineOptions(pipeline_args)
  gcloud_options = pipeline_options.view_as(GoogleCloudOptions)
  job_name = gcloud_options.job_name
  kind = known_args.kind
  num_entities = known_args.num_entities
  project = gcloud_options.project
  # Pipeline 1: Create and write the specified number of Entities to the
  # Cloud Datastore.
  ancestor_key = Key([kind, str(uuid.uuid4())], project=project)
  _LOGGER.info('Writing %s entities to %s', num_entities, project)
  p = new_pipeline_with_job_name(pipeline_options, job_name, '-write')
  _ = (
      p
      | 'Input' >> beam.Create(list(range(num_entities)))
      | 'To String' >> beam.Map(str)
      | 'To Entity' >> beam.Map(EntityWrapper(kind, ancestor_key).make_entity)
      | 'Write to Datastore' >> WriteToDatastore(project, hint_num_workers=1))
  p.METHOD_NAME()
  query = Query(kind=kind, project=project, ancestor=ancestor_key)
  # Optional Pipeline 2: If a read limit was provided, read it and confirm
  # that the expected entities were read.
  if known_args.limit is not None:
    _LOGGER.info(
        'Querying a limited set of %s entities and verifying count.',
        known_args.limit)
    p = new_pipeline_with_job_name(pipeline_options, job_name, '-verify-limit')
    query.limit = known_args.limit
    entities = p | 'read from datastore' >> ReadFromDatastore(query)
    assert_that(
        entities | beam.combiners.Count.Globally(),
        equal_to([known_args.limit]))
    p.METHOD_NAME()
    query.limit = None
  # Pipeline 3: Query the written Entities and verify result.
  _LOGGER.info('Querying entities, asserting they match.')
  p = new_pipeline_with_job_name(pipeline_options, job_name, '-verify')
  entities = p | 'read from datastore' >> ReadFromDatastore(query)
  assert_that(
      entities | beam.combiners.Count.Globally(), equal_to([num_entities]))
  p.METHOD_NAME()
  # Pipeline 4: Delete Entities.
  _LOGGER.info('Deleting entities.')
  p = new_pipeline_with_job_name(pipeline_options, job_name, '-delete')
  entities = p | 'read from datastore' >> ReadFromDatastore(query)
  _ = (
      entities
      | 'To Keys' >> beam.Map(lambda entity: entity.key)
      | 'delete entities' >> DeleteFromDatastore(project, hint_num_workers=1))
  p.METHOD_NAME()
  # Pipeline 5: Query the written Entities, verify no results.
  _LOGGER.info('Querying for the entities to make sure there are none present.')
  p = new_pipeline_with_job_name(pipeline_options, job_name, '-verify-deleted')
  entities = p | 'read from datastore' >> ReadFromDatastore(query)
  assert_that(entities | beam.combiners.Count.Globally(), equal_to([0]))
  p.METHOD_NAME()