docs: def handler(event, context):  # pylint: disable=W0613
      """Historical S3 DynamoDB Stream Forwarder (the 'Proxy').
  
      Passes events from the Historical DynamoDB stream and passes it to SNS or SQS for additional events to trigger.
  
      You can optionally use SNS or SQS. It is preferable to use SNS -> SQS, but in some cases, such as the Current stream
      to the Differ, this will make use of SQS to directly feed into the differ for performance purposes.
      """
      queue_url = os.environ.get('PROXY_QUEUE_URL')
      topic_arn = os.environ.get('PROXY_TOPIC_ARN')
  
      if not queue_url and not topic_arn:
          raise MissingProxyConfigurationException('[X] Must set the `PROXY_QUEUE_URL` or the `PROXY_TOPIC_ARN` vars.')
  
      items_to_ship = []
  
      # Must ALWAYS shrink for SQS because of 256KB limit of sending batched messages
      force_shrink = True if queue_url else False
  
      # Is this a "Simple Durable Proxy" -- that is -- are we stripping out all of the DynamoDB data from
      # the Differ?
      record_maker = make_proper_simple_record if SIMPLE_DURABLE_PROXY else make_proper_dynamodb_record
  
      for record in event['Records']:
          # We should NOT be processing this if the item in question does not
          # reside in the PROXY_REGIONS
          correct_region = True
          for img in ['NewImage', 'OldImage']:
              if record['dynamodb'].get(img):
                  if record['dynamodb'][img][REGION_ATTR]['S'] not in PROXY_REGIONS:
                      LOG.debug(f"[/] Not processing record -- record event took place in:"
                                f" {record['dynamodb'][img][REGION_ATTR]['S']}")
                      correct_region = False
                      break
  
          if not correct_region:
              continue
  
          # Global DynamoDB tables will update a record with the global table specific fields. This creates 2 events
          # whenever there is an update. The second update, which is a MODIFY event is not relevant and noise. This
          # needs to be skipped over to prevent duplicated events. This is a "gotcha" in Global DynamoDB tables.
          if detect_global_table_updates(record):
              continue
  
          items_to_ship.append(record_maker(record, force_shrink=force_shrink))
  
      if items_to_ship:
          # SQS:
          if queue_url:
              produce_events(items_to_ship, queue_url, batch_size=int(os.environ.get('PROXY_BATCH_SIZE', 10)))
  
          # SNS:
          else:
              client = boto3.client("sns", region_name=CURRENT_REGION)
              for i in items_to_ship:
                  _publish_sns_message(client, i, topic_arn)