code: def parse_wiki_legacy_tags():
      tags = [None, None, None]
      items = {}
  
      with open("wiki-legacy-tags.txt", "r", encoding="utf-8") as f:
          prev_line = None
  
          for line in f:
              if re.match("^====+\s*$", line):
                  tags[0] = prev_line.strip()
                  tags[1] = None
                  tags[2] = None
                  continue
  
              if re.match("^----+\s*$", line):
                  tags[1] = prev_line.strip()
                  tags[2] = None
                  continue
  
              if re.match('^""""+\s*$', line):
                  tags[2] = prev_line.strip()
                  continue
  
              prev_line = line
  
              m = re.search(r"\[\[(.*?)(?:\|.*)?\]\]", line)
              if m:
                  name = m.group(1).strip()
                  name = re.sub("Cookbook/", "", name)
                  name = re.sub("^/", "", name)
                  name = name.replace("/", "_").replace(" ", "_")
  
                  fn = os.path.join("ipython", name + ".ipynb")
                  if os.path.isfile(fn):
                      basename = os.path.splitext(os.path.basename(fn))[
                          0
                      ]
                      items.setdefault(basename, set()).update(
                          [x for x in tags if x]
                      )
                  continue
  
      return items
  
file_path: scipy-cookbook/build.py
imports: import re
  import os
  import argparse
  import datetime
  import subprocess
  import shutil
  import lxml.html
label_desc: Use image node_id 5 for calling a global function with example usage: parse_wiki_legacy_tags() and returns: items