docs: def parse_stream(response):
      """
      take stream from docker-py lib and display it to the user.
  
      this also builds a stream list and returns it.
      """
      stream_data = []
      stream = stdout
  
      for data in response:
          if data:
              try:
                  data = data.decode('utf-8')
              except AttributeError as e:
                  logger.exception("Unable to parse stream, Attribute Error Raised: {0}".format(e))
                  stream.write(data)
                  continue
  
              try:
                  normalized_data = normalize_keys(json.loads(data))
              except ValueError:
                  stream.write(data)
                  continue
              except TypeError:
                  stream.write(data)
                  continue
  
              if 'progress' in normalized_data:
                  stream_data.append(normalized_data)
                  _display_progress(normalized_data, stream)
  
              elif 'error' in normalized_data:
                  _display_error(normalized_data, stream)
  
              elif 'status' in normalized_data:
                  stream_data.append(normalized_data)
                  _display_status(normalized_data, stream)
  
              elif 'stream' in normalized_data:
                  stream_data.append(normalized_data)
                  _display_stream(normalized_data, stream)
              else:
                  stream.write(data)
  
      stream.flush()
      return stream_data