class_docstr: Handles preparing and sending data from the classifier function to Kinesis Firehose
docstr: Perform any final operations for this response, such as metric logging, etc
  
  Args:
      response (dict): boto3 client response object
      stream_name (str): The name of the Delivery Stream to send to
      size (int): The original size of the batch being sent
docstr_tok: ["Perform","any","final","operations","for","this","response",",","such","as","metric","logging",",","etc","Args",":","response","(","dict",")",":","boto3","client","response","object","stream_name","(","str",")",":","The","name","of","the","Delivery","Stream","to","send","to","size","(","int",")",":","The","original","size","of","the","batch","being","sent"]
code: def _finalize(cls, response, stream_name, size, function_name):
      """Perform any final operations for this response, such as metric logging, etc
  
      Args:
          response (dict): boto3 client response object
          stream_name (str): The name of the Delivery Stream to send to
          size (int): The original size of the batch being sent
      """
      if not response:
          return  # Could happen in the case of backoff failing entirely
  
      # Check for failures that occurred in PutRecordBatch after several backoff attempts
      if response.get("FailedPutCount"):
          failed_records = [
              failed
              for failed in response["RequestResponses"]
              if failed.get("ErrorCode")
          ]
          cls._log_failed(response["FailedPutCount"], function_name)
  
          # Only print the first 100 failed records to Cloudwatch logs
          LOGGER.error(
              "Failed to put the following records to firehose %s: %s",
              stream_name,
              json.dumps(failed_records[:1024], indent=2),
          )
          return
  
      MetricLogger.log_metric(
          function_name, MetricLogger.FIREHOSE_RECORDS_SENT, size
      )
      LOGGER.info(
          "Successfully sent %d message(s) to firehose %s with RequestId '%s'",
          size,
          stream_name,
          response.get("ResponseMetadata", {}).get("RequestId", ""),
      )
  
imports: from collections import defaultdict
  import json
  import hashlib
  import re
  import backoff
  import boto3
  from botocore.exceptions import ClientError, HTTPClientError
  from botocore.exceptions import ConnectionError
  from streamalert.shared import CLASSIFIER_FUNCTION_NAME
  import streamalert.shared.helpers.boto
  from streamalert.shared.logger import get_logger
  from streamalert.shared.metrics import MetricLogger
  from streamalert.shared.backoff_handlers import backoff_handler, giveup_handler, success_handler
label_desc: Use image node_id 8 for calling the FirehoseClient obj's underlying member method code with example usage: obj._finalize(cls, response, stream_name, size, function_name) without return types