Adds a new Smart Shopping ad group.

  Args:
    client: an AdWordsClient instance.
    campaign_id: the str ID of a Smart Shopping campaign.
  Returns:
    An ad group ID.

def CreateSmartShoppingAdGroup(client, campaign_id):
  """Adds a new Smart Shopping ad group.

  Args:
    client: an AdWordsClient instance.
    campaign_id: the str ID of a Smart Shopping campaign.
  Returns:
    An ad group ID.
  """
  ad_group_service = client.GetService('AdGroupService', version='v201809')
  # Create the ad group.
  ad_group = {
      'campaignId': campaign_id,
      'name': 'Smart Shopping ad group #%s' % uuid.uuid4(),
      # Set the ad group type to SHOPPING_GOAL_OPTIMIZED_ADS.
      'adGroupType': 'SHOPPING_GOAL_OPTIMIZED_ADS'
  }

  adgroup_operations = {
      'operator': 'ADD',
      'operand': ad_group
  }

  # Make the mutate request to add the AdGroup to the Smart Shopping campaign.
  ad_group = ad_group_service.mutate(adgroup_operations)['value'][0]
  ad_group_id = ad_group['id']

  print ('AdGroup with name "%s" and ID "%s" was added.'
         % (ad_group['name'], ad_group_id))

  return ad_group_id