def BuildAdGroupAdOperations(adgroup_operations):
 adgroup_ad_operations = [{'xsi_type': 'AdGroupAdOperation', 'operand': {'adGroupId': adgroup_operation['operand']['id'], 'ad': {'xsi_type': 'TextAd', 'headline': 'Luxury Cruise to Mars', 'description1': 'Visit the Red Planet in style.', 'description2': 'Low-gravity fun for everyone!', 'displayUrl': 'www.example.com', 'finalUrls': ['http://www.example.com/1']}}, 'operator': 'ADD'} for adgroup_operation in adgroup_operations]
 return adgroup_ad_operations

def BuildAdGroupAdOperations ( adgroup_operations ) : adgroup_ad_operations = [ { 'xsi_type' : 'AdGroupAdOperation' , 'operand' : { 'adGroupId' : adgroup_operation [ 'operand' ] [ 'id' ] , 'ad' : { 'xsi_type' : 'TextAd' , 'headline' : 'Luxury Cruise to Mars' , 'description1' : 'Visit the Red Planet in style.' , 'description2' : 'Low-gravity fun for everyone!' , 'displayUrl' : 'www.example.com' , 'finalUrls' : [ 'http://www.example.com/1' ] } } , 'operator' : 'ADD' } for adgroup_operation in adgroup_operations ] return adgroup_ad_operations
builds the operations adding an expandedtextad to each adgroup .