def METHOD_NAME(event, context):
    """ The main function executed by Lambda"""
    summary = {'success': [], 'fail': []}
    for b in buckets:
        # First check the bucket actually exists
        try:
            s3.head_bucket(Bucket=b)
        except botocore.exceptions.ClientError as e:
            error_code = int(e.response['Error']['Code'])
            if error_code == 404:
                send_alert_email(b, last_mod=None)
        # Then check the expected entry exists in the bucket's objects.
        files = list_bucket_keys(bucket_name=b)
        old_to_new = sorted(files, key=lambda f: f['LastModified'])
        newest = old_to_new[-1]
        # If the newest file is older than 1 day old, our backups are not up to date.
        if datetime.now(timezone.utc) - newest['LastModified'] > timedelta(days=1):
            # Send an alert
            send_alert_email(bucket=b, last_mod=newest['LastModified'])
            summary['fail'].append(b)
        else:
            summary['success'].append(b)
    print(summary)  # For the CloudWatch logs
    return str(summary)