code: def parse_docs(docs):
      """Parse the docs as a string into multiple sections."""
      lines = inspect.cleandoc(docs).split("\n")
      sections, section = [], []
      last_header, element = None, None
      for i, line in enumerate(lines):
          if not line:
              line = "\n"
          if HEADER.match(line):
              continue
  
          if (i < (len(lines) - 1)) and HEADER.match(lines[i + 1]):
              if element is not None:
                  section.append(element)
                  element = None
              sections.append((last_header, section))
              section = []
              last_header = line
              continue
  
          if (last_header is None) or (last_header == "Notes"):
              if not section:
                  section = [line]
              else:
                  section[0] = merge_lines(section[0], line.strip(" "))
  
          elif last_header == "Parameters":
              if line[:4].strip():
                  if element is not None:
                      section.append(element)
                  element = line.split(":", 1) + [""]
              else:
                  element[2] = merge_lines(element[2], line[4:])
  
          elif last_header == "References":
              if line[:2] == "..":
                  if element is not None:
                      section.append(element)
                  match = REFERENCE.match(line)
                  element = [int(match[1]), match[2]]
              else:
                  element[1] = merge_lines(element[1], line.strip())
  
      if element is not None:
          section.append(element)
      sections.append((last_header, section))
  
      return sections
  
file_path: pytorch-meta/docs/scripts/api_reference.py
imports: import importlib
  import inspect
  import re
  import yaml
  import logging
  import torch.nn
label_desc: Use image node_id 7 for calling a global function with example usage: parse_docs(docs) and returns: sections