def lambda_handler(event, context): if event['eventType'] == 'SyncTrigger': records = event['datasetRecords'] email = records.get('Email') # may be None if email and email['newValue'].endswith('@cloudacademy.com'): # guess the Company name records['Company'] = { 'newValue': 'Cloud Academy, Inc.', 'op': 'replace', } print("New event: %s" % event) return event # return same structure