code: def parse_messages_by_stream(messages_by_stream):
      
      if messages_by_stream is None:
          return []
  
      parsed = []
      for stream, messages in messages_by_stream:
          for message_id, fields in parse_messages(messages):
              parsed.append((stream, message_id, fields))
      return parsed
docs: Parse messages returned by stream
  
      Messages returned by XREAD arrive in the form:
          [stream_name,
              [
                  [message_id, [key1, value1, key2, value2, ...]],
                  ...
              ],
              ...
          ]
  
      Here we parse this into (with the help of the above parse_messages()
      function):
  
          [
              [stream_name, message_id, OrderedDict(
                  (key1, value1),
                  (key2, value2),.
                  ...
              )],
              ...
          ]