code: def autolink_replacements(what):
      """
      Create a list containing replacement tuples of the form:
      (``regex``, ``replacement``, ``obj``) for all classes and methods which are
      imported in ``MODULES`` ``__init__.py`` files. The ``replacement``
      is a reStructuredText link to their documentation.
      For example, if the docstring reads:
          This DataSet loads and saves ...
      Then the word ``DataSet``, will be replaced by
      :class:`~causalnex.io.DataSet`
      Works for plural as well, e.g:
          These ``DataSet``s load and save
      Will convert to:
          These :class:`causalnex.io.DataSet` s load and
          save
      Args:
          what (str) : The objects to create replacement tuples for. Possible
              values ["class", "func"]
      Returns:
          List[Tuple[regex, str, str]]: A list of tuples: (regex, replacement,
          obj), for all "what" objects imported in __init__.py files of
          ``MODULES``
      """
      replacements = []
      suggestions = []
      for module in MODULES:
          if what == "class":
              objects = get_classes(module)
          elif what == "func":
              objects = get_functions(module)
  
          # Look for recognised class names/function names which are
          # surrounded by double back-ticks
          if what == "class":
              # first do plural only for classes
              replacements += [
                  (
                      r"``{}``s".format(obj),
                      ":{}:`~{}.{}`\\\\s".format(what, module, obj),
                      obj,
                  )
                  for obj in objects
              ]
  
          # singular
          replacements += [
              (
                  r"``{}``".format(obj),
                  ":{}:`~{}.{}`".format(what, module, obj),
                  obj,
              )
              for obj in objects
          ]
  
          # Look for recognised class names/function names which are NOT
          # surrounded by double back-ticks, so that we can log these in the
          # terminal
          if what == "class":
              # first do plural only for classes
              suggestions += [
                  (
                      r"(?<!\w|`){}s(?!\w|`{{2}})".format(obj),
                      "``{}``s".format(obj),
                      obj,
                  )
                  for obj in objects
              ]
  
          # then singular
          suggestions += [
              (
                  r"(?<!\w|`){}(?!\w|`{{2}})".format(obj),
                  "``{}``".format(obj),
                  obj,
              )
              for obj in objects
          ]
  
      return replacements, suggestions
  
imports: import importlib
  import re
  import shutil
  import sys
  from distutils.dir_util import copy_tree
  from inspect import getmembers, isclass, isfunction
  from pathlib import Path
  from typing import List
  from click import secho, style
  from causalnex import __version__
label_desc: Use image node_id 4 for calling a global function with example usage: autolink_replacements(what) and returns: replacements,  suggestions