def METHOD_NAME():
    def mock_get_log_events(**kwargs):
        assert kwargs['logGroupName'] == 'test-log-group'
        assert kwargs['logStreamName'] == 'test-log-stream'
        raise upload_log.CLOUDWATCH.exceptions.ResourceNotFoundException(
            {'Error': {'Message': 'The specified log stream does not exist.'}}, 'operation_name'
        )
    event = {
        'prefix': 'test-prefix',
        'log_group': 'test-log-group',
        'processing_results': {
            'step_0': {
                'Error': '',
                'Cause': '{"Container": {"LogStreamName": "test-log-stream"},'
                         '"Status": "FAILED",'
                         '"StatusReason": "Task failed to start",'
                         '"Attempts": ['
                         '{"Container": {"Reason": "error message 1"}},'
                         '{"Container": {"Reason": "error message 2"}},'
                         '{"Container": {"Reason": "error message 3"}}]}'
            }
        }
    }
    with patch('upload_log.CLOUDWATCH.get_log_events', mock_get_log_events), \
            patch('upload_log.write_log_to_s3') as mock_write_log_to_s3, \
            patch.dict(os.environ, {'BUCKET': 'test-bucket'}, clear=True):
        upload_log.lambda_handler(event, None)
        mock_write_log_to_s3.assert_called_once_with(
            'test-bucket', 'test-prefix', 'error message 1\nerror message 2\nerror message 3'
        )