code: def read_and_split_frameworks(fname):
      """
      Read the MDX in fname and creates two versions (if necessary) for each framework.
      """
      with open(fname, "r") as f:
          content = f.readlines()
  
      contents = {"pt": [], "tf": []}
  
      differences = False
      current_content = []
      line_idx = 0
      for line in content:
          if re_framework_test.search(line) is not None:
              differences = True
              framework = re_framework_test.search(line).groups()[0]
              for key in contents:
                  contents[key].extend(current_content)
              current_content = []
          elif re_framework_else.search(line) is not None:
              contents[framework].extend(current_content)
              current_content = []
              framework = "pt" if framework == "tf" else "tf"
          elif re_framework_end.search(line) is not None:
              contents[framework].extend(current_content)
              current_content = []
          else:
              current_content.append(line)
  
      if len(current_content) > 0:
          for key in contents:
              contents[key].extend(current_content)
  
      if differences:
          return {
              k: "".join(content) for k, content in contents.items()
          }
      else:
          return "".join(content)
  
file_path: course/utils/generate_notebooks.py
imports: import argparse
  import os
  import re
  import nbformat
  import shutil
  import yaml
  from pathlib import Path
label_desc: Use image node_id 1 for calling a global function with example usage: read_and_split_frameworks(fname) and returns: unknown, str