code: def _iter_merge(timeseries_list):
          
          # cast to list since this is getting iterated over several
          # times (causes problem if timeseries_list is a generator)
          timeseries_list = list(timeseries_list)
  
          # Create iterators for each timeseries and then add the first
          # item from each iterator onto a priority queue. The first
          # item to be popped will be the one with the lowest time
          queue = PriorityQueue()
          for index, timeseries in enumerate(timeseries_list):
              iterator = iter(timeseries)
              try:
                  t, value = next(iterator)
              except StopIteration:
                  pass
              else:
                  queue.put((t, index, value, iterator))
  
          # `state` keeps track of the value of the merged
          # TimeSeries. It starts with the default. It starts as a list
          # of the default value for each individual TimeSeries.
          state = [ts.default for ts in timeseries_list]
          while not queue.empty():
  
              # get the next time with a measurement from queue
              t, index, next_value, iterator = queue.get()
  
              # make a copy of previous state, and modify only the value
              # at the index of the TimeSeries that this item came from
              state = list(state)
              state[index] = next_value
              yield t, state
  
              # add the next measurement from the time series to the
              # queue (if there is one)
              try:
                  t, value = next(iterator)
              except StopIteration:
                  pass
              else:
                  queue.put((t, index, value, iterator))
docs: This function uses a priority queue to efficiently yield the (time,
          value_list) tuples that occur from merging together many time
          series.