code: def lambda_handler(event, context):
      '''A Python AWS Lambda function to process aggregated records sent to KinesisAnalytics.'''
      raw_kpl_records = event['records']
      output = [process_kpl_record(kpl_record) for kpl_record in raw_kpl_records]
  
      # Print number of successful and failed records.
      success_count = sum(1 for record in output if record['result'] == 'Ok')
      failure_count = sum(1 for record in output if record['result'] == 'ProcessingFailed')
      print('Processing completed.  Successful records: {0}, Failed records: {1}.'.format(success_count, failure_count))
  
      return {'records': outputf lambda_handler(event, context):
      '''A Python AWS Lambda function to process aggregated records sent to KinesisAnalytics.'''
      raw_kpl_records = event['records']
      output = [process_kpl_record(kpl_record) for kpl_record in raw_kpl_records]
  
      # Print number of successful and failed records.
      success_count = sum(1 for record in output if record['result'] == 'Ok')
      failure_count = sum(1 for record in output if record['result'] == 'ProcessingFailed')
      print('Processing completed.  Successful records: {0}, Failed records: {1}.'.format(success_count, failure_count))
  
      return {'records': output}
docs: A Python AWS Lambda function to process aggregated records sent to KinesisAnalytics.