code: def make_link_targets(
      proj_name,
      user_name,
      repo_name,
      known_link_fname,
      out_link_fname,
      url=None,
      ml_url=None,
  ):
      """Check and make link targets
  
      If url is None or ml_url is None, check if there are links present for these
      in `known_link_fname`.  If not, raise error.  The check is:
  
      Look for a target `proj_name`.
      Look for a target `proj_name` + ' mailing list'
  
      Also, look for a target `proj_name` + 'github'.  If this exists, don't write
      this target into the new file below.
  
      If we are writing any of the url, ml_url, or github address, then write new
      file with these links, of form:
  
      .. _`proj_name`
      .. _`proj_name`: url
      .. _`proj_name` mailing list: url
      """
      with open(known_link_fname) as link_fh:
          link_contents = link_fh.readlines()
      have_url = not url is None
      have_ml_url = not ml_url is None
      have_gh_url = None
      for line in link_contents:
          if not have_url:
              match = re.match(r"..\s+_`%s`:\s+" % proj_name, line)
              if match:
                  have_url = True
          if not have_ml_url:
              match = re.match(
                  r"..\s+_`%s mailing list`:\s+" % proj_name, line
              )
              if match:
                  have_ml_url = True
          if not have_gh_url:
              match = re.match(
                  r"..\s+_`%s github`:\s+" % proj_name, line
              )
              if match:
                  have_gh_url = True
      if not have_url or not have_ml_url:
          raise RuntimeError(
              "Need command line or known project "
              "and / or mailing list URLs"
          )
      lines = []
      if not url is None:
          lines.append(f".. _`{proj_name}`: {url}\n")
      if not have_gh_url:
          gh_url = f"https://github.com/{user_name}/{repo_name}\n"
          lines.append(f".. _`{proj_name} github`: {gh_url}\n")
      if not ml_url is None:
          lines.append(f".. _`{proj_name} mailing list`: {ml_url}\n")
      if len(lines) == 0:
          # Nothing to do
          return
      # A neat little header line
      lines = [f".. {proj_name}\n"] + lines
      with open(out_link_fname, "w") as out_links:
          out_links.writelines(lines)
  
file_path: nipy/tools/gitwash_dumper.py
imports: import fnmatch
  import glob
  import os
  import re
  import shutil
  import sys
  import tempfile
  from optparse import OptionParser
  from os.path import join
  from subprocess import call
label_desc: Use image node_id 5 for calling a global function with example usage: make_link_targets(proj_name, user_name, repo_name, known_link_fname, out_link_fname, url, ml_url) without return types