code: def build_tf_extension(build_ext, global_options):
      # Backup the options, preventing other plugins access libs that
      # compiled with compiler of this plugin
      options = copy.deepcopy(global_options)
      import tensorflow as tf
  
      tf_compile_flags = tf.sysconfig.get_compile_flags()
      tf_link_flags = tf.sysconfig.get_link_flags()
      have_cuda = (
          tf.test.is_built_with_cuda() and tf.test.is_gpu_available()
      )
      updated_macros = set_macro(
          options["MACROS"], "HAVE_CUDA", str(int(have_cuda))
      )
      print(tf_compile_flags, tf_link_flags, have_cuda)
  
      if have_cuda:
          cuda_include_dirs, cuda_lib_dirs = get_cuda_dirs(
              build_ext, options["COMPILE_FLAGS"]
          )
          options["INCLUDES"] += cuda_include_dirs
          options["LIBRARY_DIRS"] += cuda_lib_dirs
          options["LIBRARIES"] += ["cudart"]
          print("INFO: Try Tensorflow extension with CUDA.")
  
      bluefog_tensorflow_mpi_lib.define_macros = updated_macros
      bluefog_tensorflow_mpi_lib.include_dirs = options["INCLUDES"]
      bluefog_tensorflow_mpi_lib.sources = options["SOURCES"] + [
          "bluefog/tensorflow/adapter.cc",
          "bluefog/tensorflow/mpi_ops.cc",
      ]
      bluefog_tensorflow_mpi_lib.extra_compile_args = (
          options["COMPILE_FLAGS"] + tf_compile_flags
      )
      bluefog_tensorflow_mpi_lib.extra_link_args = (
          options["LINK_FLAGS"] + tf_link_flags
      )
      bluefog_tensorflow_mpi_lib.library_dirs = options["LIBRARY_DIRS"]
      bluefog_tensorflow_mpi_lib.libraries = options["LIBRARIES"]
      bluefog_tensorflow_mpi_lib.extra_objects = options[
          "EXTRA_OBJECTS"
      ]
  
      build_ext.build_extension(bluefog_tensorflow_mpi_lib)
  
imports: import copy
  import os
  import re
  import shlex
  import subprocess
  import sys
  import textwrap
  import shlex
  import traceback
  from typing import List
  from distutils.errors import CompileError, DistutilsError, DistutilsPlatformError, DistutilsSetupError, LinkError
  from distutils.version import LooseVersion
  from setuptools import find_packages, setup, Extension
  from setuptools.command.build_ext import build_ext
  from bluefog import __version__
label_desc: Use image node_id 11 for calling a global function with example usage: build_tf_extension(build_ext, global_options) without return types