def main(client, user_id):
  # Initialize appropriate service.
  user_team_association_service = client.GetService(
      'UserTeamAssociationService', version='v201508')

  # Create filter text to select user team associations by the user ID.
  values = [{
      'key': 'userId',
      'value': {
          'xsi_type': 'NumberValue',
          'value': user_id
      }
  }]
  query = 'WHERE userId = :userId'

  # Create a filter statement.
  statement = dfp.FilterStatement(query, values)

  # Get user team associations by statement.
  response = user_team_association_service.getUserTeamAssociationsByStatement(
      statement.ToStatement())
  user_team_associations = response['results'] if 'results' in response else []

  for user_team_association in user_team_associations:
    print ('User team association between user with ID \'%s\' and team with '
           'ID \'%s\' will be deleted.' % (user_team_association['userId'],
                                           user_team_association['teamId']))
  print ('Number of teams that the user will be removed from: %s' %
         len(user_team_associations))

  # Perform action.
  result = user_team_association_service.performUserTeamAssociationAction(
      {'xsi_type': 'DeleteUserTeamAssociations'},
      {'query': query, 'values': values})

  # Display results.
  if result and 0 > int(result['numChanges']):
    print ('Number of teams that the user was removed from: %s'
           % result['numChanges'])
  else:
    print 'No user team associations were deleted.'
dataset/ETHPy150Open googleads/googleads-python-lib/examples/dfp/v201508/user_team_association_service/delete_user_team_associations.py/main/swapped operands of `>`