code: def _upload_actual_data(
      sagemaker_session, endpoint_name, actuals_s3_uri_base
  ):
      current_hour_date_time = datetime.utcnow()
      previous_hour_date_time = current_hour_date_time - timedelta(
          hours=1
      )
      captures = os.path.join(DATA_DIR, "monitor/capture.jsonl")
      actuals = os.path.join(DATA_DIR, "monitor/actuals.jsonl")
  
      def _upload(s3_uri_base, input_file_name, target_time, file_name):
          time_folder = target_time.strftime("%Y/%m/%d/%H")
          time_str = str(target_time.strftime("%Y-%m-%dT%H:%M:%S.%f"))
          s3_uri = os.path.join(s3_uri_base, time_folder, file_name)
  
          up_to_date_lines = []
          with open(input_file_name, "r") as input_file:
              for line in input_file:
                  json_l = json.loads(line)
                  json_l["eventMetadata"]["inferenceTime"] = time_str
                  up_to_date_lines.append(json.dumps(json_l))
  
          file_target = "\n".join(up_to_date_lines)
  
          return S3Uploader.upload_string_as_file_body(
              file_target,
              desired_s3_uri=s3_uri,
              sagemaker_session=sagemaker_session,
          )
  
      capture_s3_uri_base = os.path.join(
          "s3://",
          sagemaker_session.default_bucket(),
          sagemaker_session.default_bucket_prefix,
          "model-monitor",
          "data-capture",
          endpoint_name,
          "AllTraffic",
      )
  
      capture_path_now = _upload(
          capture_s3_uri_base,
          captures,
          current_hour_date_time,
          "capture_data.jsonl",
      )
      capture_path = _upload(
          capture_s3_uri_base,
          captures,
          previous_hour_date_time,
          "capture_data.jsonl",
      )
      print(
          "Uploading captured data to {} and {}.".format(
              capture_path_now, capture_path
          )
      )
  
      if actuals_s3_uri_base is not None:
          _upload(
              actuals_s3_uri_base,
              actuals,
              current_hour_date_time,
              "actuals_data.jsonl",
          )
          _upload(
              actuals_s3_uri_base,
              actuals,
              previous_hour_date_time,
              "actuals_data.jsonl",
          )
          print(
              "Uploading actuals data to {}.".format(
                  actuals_s3_uri_base
              )
          )
      return actuals_s3_uri_base
  
imports: from __future__ import print_function, absolute_import
  from datetime import datetime, timedelta
  import json
  import numpy
  import os
  import pandas
  import pytest
  import tempfile
  import uuid
  import time
  import tests.integ
  import tests.integ.timeout
  from sagemaker import image_uris, utils
  from sagemaker.model_monitor import BiasAnalysisConfig, CronExpressionGenerator, DataCaptureConfig, EndpointInput, ExplainabilityAnalysisConfig, ModelBiasMonitor, ModelExplainabilityMonitor, BatchTransformInput, MonitoringDatasetFormat
  from sagemaker.s3 import S3Uploader
  from sagemaker.utils import unique_name_from_base
  from sagemaker.clarify import BiasConfig, DataConfig, ModelConfig, ModelPredictedLabelConfig, SHAPConfig
  from sagemaker.model import Model
  from tests.integ import DATA_DIR
  from tests.integ.retry import retries
label_desc: Use image node_id 24 for calling a global function with example usage: _upload_actual_data(sagemaker_session, endpoint_name, actuals_s3_uri_base) and returns: actuals_s3_uri_base, S3Uploader