code: def split_lines(nb):
      """split likely multiline text into lists of strings
  
      For file output more friendly to line-based VCS. ``rejoin_lines(nb)`` will
      reverse the effects of ``split_lines(nb)``.
  
      Used when writing JSON files.
      """
      for cell in nb.cells:
          source = cell.get("source", None)
          if isinstance(source, str):
              cell["source"] = source.splitlines(True)
  
          attachments = cell.get("attachments", {})
          for _, attachment in attachments.items():
              _split_mimebundle(attachment)
  
          if cell.cell_type == "code":
              for output in cell.outputs:
                  if output.output_type in {
                      "execute_result",
                      "display_data",
                  }:
                      _split_mimebundle(output.get("data", {}))
                  elif output.output_type == "stream" and isinstance(
                      output.text, str
                  ):
                      output.text = output.text.splitlines(True)
      return nb
  
file_path: nbformat/nbformat/v4/rwbase.py
imports: from __future__ import annotations
label_desc: Use image node_id 5 for calling a global function with example usage: split_lines(nb) and returns: nb