code: def _get_pattern():
      pattern = os.getenv("GALLERY_PATTERN")
      # If BUILD_GALLERY is falsy -> no build
      # If BUILD_GALLERY is truey -> build
      # If BUILD_GALLERY is undefined
      #    If GALLERY_PATTERN is defined     -> build
      #    If GALLERY_PATTERN is not defined -> not build
      if not _get_var(
          "BUILD_GALLERY", default=False if pattern is None else True
      ):
          if pattern is not None:
              print(
                  ' --- WARNING: "GALLERY_PATTERN" is provided, but "BUILD_GALLERY" value is falsy. '
                  "Sphinx galleries are not built. To build galleries, set `BUILD_GALLERY=1`."
              )
          return {
              "ignore_pattern": r"\.py",
          }
  
      ret = {"filename_pattern": "tutorial.py"}
      if os.getenv("GALLERY_PATTERN"):
          # See https://github.com/pytorch/tutorials/blob/cbf2238df0e78d84c15bd94288966d2f4b2e83ae/conf.py#L75-L83
          ret["ignore_pattern"] = (
              r"/(?!"
              + re.escape(os.getenv("GALLERY_PATTERN"))
              + r")[^/]+$"
          )
      return ret
  
file_path: audio/docs/source/conf.py
imports: import os
  import re
  import sys
  import warnings
  from datetime import datetime
  import pytorch_sphinx_theme
  from docutils import nodes
  from sphinx import addnodes
  from sphinx.util.docfields import TypedField
  from custom_directives import CustomCardEnd, CustomCardItem, CustomCardStart, SupportedDevices, SupportedProperties
  from docutils.parsers import rst
label_desc: Use image node_id 2 for calling a global function with example usage: _get_pattern() and returns: ret, dict