class_docstr: SQSClient for sending batches of classified records to the Rules Engine function
class_docstr_tok: ["SQSClient","for","sending","batches","of","classified","records","to","the","Rules","Engine","function"]
code: def _segment_records(cls, records):
      batch_size = 2  # for [] chars on array
      batch = []
      record_count = len(records)
      for idx, record in enumerate(records, start=1):
          # for , between records
          size = len(record) + (
              1 if idx != record_count and batch else 0
          )
          if size + 2 > cls.MAX_SIZE:
              LOGGER.error(
                  "Record is too large to send to SQS:\n%s", record
              )
              MetricLogger.log_metric(
                  FUNCTION_NAME, MetricLogger.SQS_FAILED_RECORDS, 1
              )
              continue
  
          if idx == record_count or size + batch_size >= cls.MAX_SIZE:
              if size + batch_size >= cls.MAX_SIZE:
                  yield batch[:], len(batch)
  
              if idx == record_count:  # the end of the records
                  if (
                      size + batch_size < cls.MAX_SIZE
                  ):  # this record fits on current batch
                      batch.append(record)
                      yield batch[:], len(batch)
                  else:
                      yield [record], 1
                  return
  
              del batch[:]
              batch_size = 2
  
          batch.append(record)
          batch_size += size
  
imports: import json
  import os
  import backoff
  import boto3
  from botocore.exceptions import ClientError, HTTPClientError
  from botocore.exceptions import ConnectionError
  from streamalert.shared import CLASSIFIER_FUNCTION_NAME
  from streamalert.shared.helpers import 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 3 for calling the SQSClient obj's underlying member method code with example usage: obj._segment_records(cls, records) without return types