code: def generate(combinations, test_combinations=()):
      # pylint: disable=g-doc-args,g-doc-return-or-yield
      """Distributed adapter of `tf.__internal__.test.combinations.generate`.
  
      All tests with distributed strategy should use this one instead of
      `tf.__internal__.test.combinations.generate`. This function has support of
      strategy combinations, GPU/TPU and multi worker support.
  
      See `tf.__internal__.test.combinations.generate` for usage.
      """
      # pylint: enable=g-doc-args,g-doc-return-or-yield
      default_combinations = (
          framework_combinations.EagerGraphCombination(),
          framework_combinations.TFVersionCombination(),
          ClusterCombination(),
          DistributionCombination(),
          GPUCombination(),
          TPUCombination(),
      )
      # We apply our own decoration to handle multi worker tests before applying
      # framework.test_combinations.generate. The order is important since we need
      # framework.test_combinations.generate to apply all parameter modifiers first.
      combination_decorator = combinations_lib.generate(
          combinations,
          test_combinations=default_combinations + test_combinations,
      )
  
      def decorator(test_method_or_class):
          if isinstance(test_method_or_class, type):
              # If it's a test class.
              class_object = test_method_or_class
              # Decorate each test method with _multi_worker_test.
              for name, test_method in six.iteritems(
                  class_object.__dict__.copy()
              ):
                  if name.startswith(
                      unittest.TestLoader.testMethodPrefix
                  ) and isinstance(test_method, types.FunctionType):
                      setattr(
                          class_object,
                          name,
                          _multi_worker_test(test_method),
                      )
              return combination_decorator(class_object)
          else:
              return combination_decorator(
                  _multi_worker_test(test_method_or_class)
              )
  
      return decorator
  
imports: import collections
  import copy
  import re
  import sys
  import types
  import unittest
  from absl import app
  import six
  from tensorflow.python.client import session
  from tensorflow.python.distribute import collective_all_reduce_strategy
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute import multi_process_runner
  from tensorflow.python.distribute import multi_worker_test_base
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import config
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_combinations
  from tensorflow.python.framework import test_util
  from tensorflow.python.platform import flags
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import tf_decorator
  from tensorflow.python.util import tf_inspect
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 2 for calling a global function with example usage: generate(combinations, test_combinations) and returns: decorator, combination_decorator, combination_decorator