code: def printLogs(logGroupName, logStreamName, startTime):
      kwargs = {
          "logGroupName": logGroupName,
          "logStreamName": logStreamName,
          "startTime": startTime,
          "startFromHead": True,
      }
  
      lastTimestamp = startTime - 1
      while True:
          logEvents = cloudwatch.get_log_events(**kwargs)
  
          for event in logEvents["events"]:
              lastTimestamp = event["timestamp"]
              timestamp = datetime.utcfromtimestamp(
                  lastTimestamp / 1000.0
              ).isoformat()
              print(
                  "[{}] {}".format(
                      (timestamp + ".000")[:23] + "Z", event["message"]
                  )
              )
  
          nextToken = logEvents["nextForwardToken"]
          if nextToken and kwargs.get("nextToken") != nextToken:
              kwargs["nextToken"] = nextToken
          else:
              break
      return lastTimestamp
  
file_path: d2l-en/ci/submit-job.py
imports: import argparse
  import random
  import os
  import re
  import sys
  import time
  from datetime import datetime
  import boto3
  from botocore.compat import total_seconds
  from botocore.config import Config
label_desc: Use image node_id 1 for calling a global function with example usage: printLogs(logGroupName, logStreamName, startTime) and returns: lastTimestamp