<s> import heapq <EOL> def _decorate_source ( source ) : <EOL> for message in source : <EOL> yield ( ( message . dt , message . source_id ) , message ) <EOL> def date_sorted_sources ( * sources ) : <EOL> """<STR_LIT>""" <EOL> sorted_stream = heapq . merge ( * ( _decorate_source ( s ) for s in sources ) ) <EOL> for _ , message in sorted_stream : <EOL> yield message </s>
