code: def rejoin_lines(nb):
      """rejoin multiline text into strings
  
      For reversing effects of ``split_lines(nb)``.
  
      This only rejoins lines that have been split, so if text objects were not split
      they will pass through unchanged.
  
      Used when reading JSON files that may have been passed through split_lines.
      """
      for cell in nb.cells:
          if "source" in cell and isinstance(cell.source, list):
              cell.source = "".join(cell.source)
  
          attachments = cell.get("attachments", {})
          for _, attachment in attachments.items():
              _rejoin_mimebundle(attachment)
  
          if cell.get("cell_type", None) == "code":
              for output in cell.get("outputs", []):
                  output_type = output.get("output_type", "")
                  if output_type in {"execute_result", "display_data"}:
                      _rejoin_mimebundle(output.get("data", {}))
                  elif output_type and isinstance(
                      output.get("text", ""), list
                  ):
                      output.text = "".join(output.text)
      return nb
  
file_path: nbformat/nbformat/v4/rwbase.py
imports: from __future__ import annotations
label_desc: Use image node_id 3 for calling a global function with example usage: rejoin_lines(nb) and returns: nb