in 04_streaming/simulate/simulate.py [0:0]
def publish(publisher, topics, allevents, notify_time):
timestamp = notify_time.strftime(RFC3339_TIME_FORMAT)
for key in topics: # 'departed', 'arrived', etc.
topic = topics[key]
events = allevents[key]
# the client automatically batches
logging.info('Publishing {} {} till {}'.format(len(events), key, timestamp))
for event_data in events:
publisher.publish(topic, event_data.encode(), EventTimeStamp=timestamp)