code: def _custom_edit_url(
      github_user,
      github_repo,
      github_version,
      doc_path,
      file_name,
      default_edit_page_url_template,
  ):
      """Create custom 'edit' URLs for API modules since they are dynamically generated."""
      if file_name.startswith("api/"):
          # this is a dynamically generated API page, link to actual Python source
          modpath = os.sep.join(
              os.path.splitext(file_name[4:])[0].split(".")
          )
          if modpath == "modules":
              # main package listing
              modpath = "vispy"
          rel_modpath = os.path.join("..", modpath)
          if os.path.isdir(rel_modpath):
              doc_path = modpath + "/"
              file_name = "__init__.py"
          elif os.path.isfile(rel_modpath + ".py"):
              doc_path = os.path.dirname(modpath)
              file_name = os.path.basename(modpath) + ".py"
          else:
              warnings.warn(
                  f"Not sure how to generate the API URL for: {file_name}"
              )
      return default_edit_page_url_template.format(
          github_user=github_user,
          github_repo=github_repo,
          github_version=github_version,
          doc_path=doc_path,
          file_name=file_name,
      )
  
file_path: vispy/doc/conf.py
imports: from datetime import date
  import sys
  import os
  import re
  import warnings
  import vispy
  from sphinx_gallery.sorting import FileNameSortKey
label_desc: Use image node_id 1 for calling a global function with example usage: _custom_edit_url(github_user, github_repo, github_version, doc_path, file_name, default_edit_page_url_template) and returns: default_edit_page_url_template