code: def _read_sse(cls, buffer: io.StringIO) -> SSE:
      event: SSEArgs = {}
      data_buffer: io.StringIO | None = None
      first_data_line = True
  
      while True:
          line = buffer.readline()
          if not line:
              break
          if line == "\n":
              break
          if line.startswith("data: "):
              if first_data_line:
                  first_data_line = False
                  event["data"] = line[6:-1]
              else:
                  if data_buffer is None:
                      # only init data_buffer when there is more than one data line
                      data_buffer = io.StringIO()
                      data_buffer.write(event.get("data", ""))
                  data_buffer.write("\n")
                  data_buffer.write(line[6:-1])
          if line.startswith("event: "):
              event["event"] = line[7:].strip()
          if line.startswith("id: "):
              event["id"] = line[4:].strip()
          if line.startswith("retry: "):
              event["retry"] = int(line[7:].strip())
  
      if data_buffer is not None:
          event["data"] = data_buffer.getvalue()
          data_buffer.close()
  
      return SSE(**event)
  
imports: from __future__ import annotations
  import io
  import typing
  import attr
  from bentoml.exceptions import BentoMLException
label_desc: Use image node_id 2 for calling the SSE obj's underlying member method code with example usage: obj._read_sse(cls, buffer) and returns: SSE