code: def update_extension(extension, requires_math=True):
      import numpy as np
  
      numpy_includes = [np.get_include()]
      extra_incl = pjoin(dirname(inspect.getfile(np.core)), "include")
      numpy_includes += [extra_incl]
      numpy_includes = list(set(numpy_includes))
      numpy_math_libs = {
          "include_dirs": [np.get_include()],
          "library_dirs": [os.path.join(np.get_include(), "..", "lib")],
          "libraries": ["npymath"],
      }
  
      if not hasattr(extension, "include_dirs"):
          return
      extension.include_dirs = list(
          set(extension.include_dirs + numpy_includes)
      )
      if requires_math:
          extension.include_dirs += numpy_math_libs["include_dirs"]
          extension.libraries += numpy_math_libs["libraries"]
          extension.library_dirs += numpy_math_libs["library_dirs"]
  
imports: from setuptools import Command, Extension, find_packages, setup
  from setuptools.dist import Distribution
  from packaging.version import parse
  from collections import defaultdict
  import fnmatch
  import inspect
  import os
  from os.path import dirname, join, relpath
  from pathlib import Path
  import shutil
  import sys
label_desc: Use image node_id 1 for calling a global function with example usage: update_extension(extension, requires_math) without return types