def main(client, ad_group_id):
  # Initialize appropriate service.
  mutate_job_service = client.GetService('MutateJobService', version='v201509')

  # Create list of all operations for the job.
  operations = []

    # Create AdGroupCriterionOperations to add keywords.
  for i in range(KEYWORD_NUMBER):
    keyword = 'mars%d' % i
    if random.randint(1, 10) == 1:
      keyword += '!!!'
    operations.append({
        'xsi_type': 'AdGroupCriterionOperation',
        'operator': 'ADD',
        'operand': {
            'xsi_type': 'BiddableAdGroupCriterion',
            'adGroupId': ad_group_id,
            'criterion': {
                'xsi_type': 'Keyword',
                'matchType': 'BROAD',
                'text': keyword
            }
        }
    })

  # You can specify up to 3 job IDs that must successfully complete before
  # this job can be processed.
  policy = {
      'prerequisiteJobIds': []
  }

  # Call mutate to create a new job.
  response = mutate_job_service.mutate(operations, policy)

  if not response:
    raise errors.GoogleAdsError('Failed to submit a job; aborting.')

  job_id = response['id']
  print 'Job with ID %s was successfully created.' % job_id

  # Create selector to retrieve job status and wait for it to complete.
  selector = {
      'xsi_type': 'BulkMutateJobSelector',
      'jobIds': [job_id]
  }

  time.sleep(RETRY_INTERVAL)
  # Poll for job status until it's finished.
  print 'Retrieving job status...'
  for i in range(RETRIES_COUNT):
    job_status_response = mutate_job_service.get(selector)
    status = job_status_response[0]['status']
    if status in ('COMPLETED', 'FAILED'):
      break
    print ('[%d] Current status is \'%s\', waiting %d seconds to retry...' %
           (i, status, RETRY_INTERVAL))
    time.sleep(RETRY_INTERVAL)

  if status == 'FAILED':
    raise errors.GoogleAdsError('Job failed with reason: \'%s\'' %
                                job_status_response[0]['failure_reason'])
  if ('PROCESSING', 'PENDING') in status:
    raise errors.GoogleAdsError('Job did not complete within %d seconds' %
                                (RETRY_INTERVAL * (RETRIES_COUNT - 1)))

  # Status must be COMPLETED.
  # Get the job result. Here we re-use the same selector.
  result_response = mutate_job_service.getResult(selector)

  # Output results.
  index = 0
  for result in result_response['SimpleMutateResult']['results']:
    if 'PlaceHolder' in result:
      print 'Operation [%d] - FAILED' % index
    else:
      print 'Operation [%d] - SUCCEEDED' % index
    index += 1

  # Output errors
  for error in result_response['SimpleMutateResult']['errors']:
    index = int(re.search(INDEX_REGEX, error['fieldPath']).group(1))
    reason = error['reason']
    keyword = operations[index]['operand']['criterion']['text']
    print ('ERROR - keyword \'%s\' failed due to \'%s\'' %
           (keyword, reason))
dataset/ETHPy150Open googleads/googleads-python-lib/examples/adwords/v201509/campaign_management/add_keywords_in_bulk.py/main/swapped operands of `in`