code: def multi_stream_iter(client, log_group, streams, positions=None):
      """Iterate over the available events coming from a set of log streams.
  
      Log streams are in a single log group interleaving the events from each stream
      so they're yielded in timestamp order.
  
      Args:
          client (boto3 client): The boto client for logs.
          log_group (str): The name of the log group.
          streams (list of str): A list of the log stream names. The position of the stream in
          this list is the stream number.
          positions: (list of Positions): A list of pairs of (timestamp, skip) which represents
          the last record read from each stream.
  
      Yields:
          A tuple of (stream number, cloudwatch log event).
      """
      positions = positions or {
          s: Position(timestamp=0, skip=0) for s in streams
      }
      event_iters = [
          log_stream(
              client,
              log_group,
              s,
              positions[s].timestamp,
              positions[s].skip,
          )
          for s in streams
      ]
      events = []
      for s in event_iters:
          if not s:
              events.append(None)
              continue
          try:
              events.append(next(s))
          except StopIteration:
              events.append(None)
  
      while some(events):
          i = argmin(
              events, lambda x: x["timestamp"] if x else 9999999999
          )
          yield (i, events[i])
          try:
              events[i] = next(event_iters[i])
          except StopIteration:
              events[i] = None
  
file_path: sagemaker-python-sdk/src/sagemaker/logs.py
imports: from __future__ import absolute_import
  import collections
  import functools
  import os
  import sys
label_desc: Use image node_id 3 for calling a global function with example usage: multi_stream_iter(client, log_group, streams, positions) without return types