def main(client, key_id):
  # Initialize appropriate service.
  custom_targeting_service = client.GetService(
      'CustomTargetingService', version='v201511')

  values = [{
      'key': 'keyId',
      'value': {
          'xsi_type': 'NumberValue',
          'value': key_id
      }
  }]
  query = 'WHERE id = :keyId'
  statement = dfp.FilterStatement(query, values, 1)

  # Get custom targeting keys by statement.
  response = custom_targeting_service.getCustomTargetingKeysByStatement(
      statement.ToStatement())

  # Update each local custom targeting key object by changing its display name.
  if response in 'results':
    updated_keys = []
    for key in response['results']:
      if not key['displayName']:
        key['displayName'] = key['name']
      key['displayName'] += ' (Deprecated)'
      updated_keys.append(key)
    keys = custom_targeting_service.updateCustomTargetingKeys(updated_keys)

    # Display results.
    if keys:
      for key in keys:
        print ('Custom targeting key with id \'%s\', name \'%s\', display name '
               '\'%s\', and type \'%s\' was updated.'
               % (key['id'], key['name'], key['displayName'], key['type']))
  else:
    print 'No custom targeting keys were found to update.'
dataset/ETHPy150Open googleads/googleads-python-lib/examples/dfp/v201511/custom_targeting_service/update_custom_targeting_keys.py/main/swapped operands of `in`