code: def _linkcode_resolve(domain, info, package, url_fmt, revision):
      """Determine a link to online source for a class/method/function
  
      This is called by sphinx.ext.linkcode
  
      An example with a long-untouched module that everyone has
      >>> _linkcode_resolve('py', {'module': 'tty',
      ...                          'fullname': 'setraw'},
      ...                   package='tty',
      ...                   url_fmt='http://hg.python.org/cpython/file/'
      ...                           '{revision}/Lib/{package}/{path}#L{lineno}',
      ...                   revision='xxxx')
      'http://hg.python.org/cpython/file/xxxx/Lib/tty/tty.py#L18'
      """
  
      if revision is None:
          return
      if domain not in ("py", "pyx"):
          return
      if not info.get("module") or not info.get("fullname"):
          return
  
      class_name = info["fullname"].split(".")[0]
      module = __import__(info["module"], fromlist=[class_name])
      obj = attrgetter(info["fullname"])(module)
  
      # Unwrap the object to get the correct source
      # file in case that is wrapped by a decorator
      obj = inspect.unwrap(obj)
  
      fn: str = None
      lineno: str = None
  
      try:
          fn = inspect.getsourcefile(obj)
      except Exception:
          fn = None
      if not fn:
          try:
              fn = inspect.getsourcefile(sys.modules[obj.__module__])
          except Exception:
              fn = None
  
      if not fn:
          # Possibly Cython code. Search docstring for source
          m = source_regex.search(obj.__doc__)
  
          if m is not None:
              source_file = m.group(1)
              lineno = m.group(2)
  
              # fn is expected to be the absolute path.
              fn = os.path.relpath(source_file, start=package)
              print(
                  "{}:{}".format(
                      os.path.abspath(
                          os.path.join("..", "python", "cuml", fn)
                      ),
                      lineno,
                  )
              )
          else:
              return
      else:
          if fn.endswith(".pyx"):
              sp_path = next(
                  x for x in sys.path if re.match(".*site-packages$", x)
              )
              fn = fn.replace(
                  "/opt/conda/conda-bld/work/python", sp_path
              )
  
          # Convert to relative from module root
          fn = os.path.relpath(
              fn, start=os.path.dirname(__import__(package).__file__)
          )
  
      # Get the line number if we need it. (Can work without it)
      if lineno is None:
          try:
              lineno = inspect.getsourcelines(obj)[1]
          except Exception:
              # Can happen if its a cyfunction. See if it has `__code__`
              if hasattr(obj, "__code__"):
                  lineno = obj.__code__.co_firstlineno
              else:
                  lineno = ""
      return url_fmt.format(
          revision=revision, package=package, path=fn, lineno=lineno
      )
  
file_path: cuml/docs/source/sphinxext/github_link.py
imports: import inspect
  import os
  import re
  import subprocess
  import sys
  from functools import partial
  from operator import attrgetter
label_desc: Use image node_id 3 for calling a global function with example usage: _linkcode_resolve(domain, info, package, url_fmt, revision) and returns: url_fmt