Creates the expanded Dynamic Search Ad.

  Args:
    client: an AdwordsClient instance.
    ad_group_id: an integer ID of the ad group in which the DSA is added.

def _CreateExpandedDSA(client, ad_group_id):
  """Creates the expanded Dynamic Search Ad.

  Args:
    client: an AdwordsClient instance.
    ad_group_id: an integer ID of the ad group in which the DSA is added.
  """
  # Get the AdGroupAdService.
  ad_group_ad_service = client.GetService('AdGroupAdService')

  # Create the operation
  operations = [{
      'operator': 'ADD',
      'operand': {
          'xsi_type': 'AdGroupAd',
          'adGroupId': ad_group_id,
          # Create the expanded dynamic search ad. This ad will have its
          # headline and final URL auto-generated at serving time according to
          # domain name specific information provided by DynamicSearchAdsSetting
          # at the campaign level.
          'ad': {
              'xsi_type': 'ExpandedDynamicSearchAd',
              # Set the ad description.
              'description': 'Buy your tickets now!',
              'description2': 'Discount ends soon'
          },
          # Optional: Set the status.
          'status': 'PAUSED',
      }
  }]

  # Create the ad.
  ad = ad_group_ad_service.mutate(operations)['value'][0]['ad']

  # Display the results.
  print ('Expanded dynamic search ad with ID "%d", description "%s", and '
         'description 2 "%s" was added'
         % (ad['id'], ad['description'], ad['description2']))