code: def build_extensions(self):
      options = get_common_options(self)
      built_plugins = []
  
      # If PyTorch is installed, it must be imported before others, otherwise
      # we may get an error: dlopen: cannot load any more object with static TLS
      if not os.environ.get("BLUEFOG_WITHOUT_PYTORCH"):
          dummy_import_torch()
  
      # Disable the tensorflow built since it is supported yet.
      if False and not os.environ.get("BLUEFOG_WITHOUT_TENSORFLOW"):
          try:
              check_tf_version()
              build_tf_extension(self, options)
              built_plugins.append(True)
              print("INFO: Tensorflow extension is built successfully.")
          except:  # pylint: disable=bare-except
              if not os.environ.get("BLUEFOG_WITH_TENSORFLOW"):
                  print(
                      "INFO: Unable to build TensorFlow plugin, will skip it.\n\n"
                      "%s" % traceback.format_exc(),
                      file=sys.stderr,
                  )
                  built_plugins.append(False)
              else:
                  raise
  
      if not os.environ.get("BLUEFOG_WITHOUT_PYTORCH"):
          try:
              torch_version = check_torch_version()
              build_torch_extension(self, options, torch_version)
              built_plugins.append(True)
              print("INFO: PyTorch extension is built successfully.")
          except:  # pylint: disable=bare-except
              if not os.environ.get("BLUEFOG_WITH_TENSORFLOW"):
                  print(
                      "INFO: Unable to build PyTorch plugin, will skip it.\n\n"
                      "%s" % traceback.format_exc()
                  )
                  built_plugins.append(False)
              else:
                  raise
  
      if not built_plugins:
          raise DistutilsError(
              "TensorFlow and PyTorch plugins were excluded from build. Aborting."
          )
  
      if not any(built_plugins):
          raise DistutilsError(
              "Neither PyTorch or TensorFlow plugins were built. See errors above."
          )
  
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 1 for calling the custom_build_ext obj's underlying member method code with example usage: obj.build_extensions() without return types