import uuid


def _CreateCampaignGroup(client):
  """Create a campaign group.

  Args:
    client: an AdWordsClient instance.

  Returns:
    The integer ID of the created campaign group.
  """
  # Get the CampaignGroupService.
  campaign_group_service = client.GetService('CampaignGroupService',
                                             version='v201802')

  # Create the operation.
  operations = [{
      'operator': 'ADD',
      # Create the campaign group.
      'operand': {
          'name': 'Mars campaign group #%d' % uuid.uuid4()
      }
  }]

  campaign_group = campaign_group_service.mutate(operations)['value'][0]
  campaign_group_id = campaign_group['id']

  # Display the results.
  print('Campaign group with ID "%d" and name "%s" was created.' % (
      campaign_group_id, campaign_group['name']))

  return campaign_group_id