DRY hash_to_stream