code: def generate_docstring(subclass, clsname):
      # Generate a Visual+Node docstring by modifying the Visual's docstring
      # to include information about Node inheritance and extra init args.
  
      sc_doc = subclass.__doc__
      if sc_doc is None:
          sc_doc = ""
  
      # find locations within docstring to insert new parameters
      lines = sc_doc.split("\n")
  
      # discard blank lines at start
      while lines and lines[0].strip() == "":
          lines.pop(0)
  
      i = 0
      params_started = False
      param_indent = None
      first_blank = None
      param_end = None
      while i < len(lines):
          line = lines[i]
          # ignore blank lines and '------' lines
          if re.search(r"\w", line):
              indent = len(line) - len(line.lstrip())
              # If Params section has already started, check for end of params
              # (that is where we will insert new params)
              if params_started:
                  if indent < param_indent:
                      break
                  elif indent == param_indent:
                      # might be end of parameters block..
                      if (
                          re.match(r"\s*[a-zA-Z0-9_]+\s*:\s*\S+", line)
                          is None
                      ):
                          break
                  param_end = i + 1
  
              # Check for beginning of params section
              elif re.match(r"\s*Parameters\s*", line):
                  params_started = True
                  param_indent = indent
                  if first_blank is None:
                      first_blank = i
  
          # Check for first blank line
          # (this is where the Node inheritance description will be
          # inserted)
          elif first_blank is None and line.strip() == "":
              first_blank = i
  
          i += 1
          if i == len(lines) and param_end is None:
              # reached end of docstring; insert here
              param_end = i
  
      # If original docstring has no params heading, we need to generate it.
      if not params_started:
          lines.extend(["", "    Parameters", "    ----------"])
          param_end = len(lines)
          if first_blank is None:
              first_blank = param_end - 3
          params_started = True
  
      # build class and parameter description strings
      class_desc = (
          "\n    This class inherits from visuals.%sVisual and "
          "scene.Node, allowing the visual to be placed inside a "
          "scenegraph.\n" % (clsname)
      )
      parm_doc = (
          "    parent : Node\n"
          "        The parent node to assign to this node (optional).\n"
          "    name : string\n"
          "        A name for this node, used primarily for debugging\n"
          "        (optional)."
      )
  
      # assemble all docstring parts
      lines = (
          lines[:first_blank]
          + [class_desc]
          + lines[first_blank:param_end]
          + [parm_doc]
          + lines[param_end:]
      )
  
      doc = "\n".join(lines)
      return doc
  
file_path: vispy/vispy/scene/visuals.py
imports: import re
  import weakref
  from ..None import visuals
  from .node import Node
  from ..visuals.filters import Alpha, PickingFilter
  from typing import TypeVar
label_desc: Use image node_id 2 for calling a global function with example usage: generate_docstring(subclass, clsname) and returns: doc