code: def specialize_class(cls, kind, base=None, **kwargs):
      # XXX Support passing in submodule names--load (and cache) them?
      # That would clean up the test modules a bit more.
      if base is None:
          base = unittest.TestCase
      elif not isinstance(base, type):
          base = base[kind]
      name = "{}_{}".format(kind, cls.__name__)
      bases = (cls, base)
      specialized = types.new_class(name, bases)
      specialized.__module__ = cls.__module__
      specialized._NAME = cls.__name__
      specialized._KIND = kind
      for attr, values in kwargs.items():
          value = values[kind]
          setattr(specialized, attr, value)
      return specialized
  
imports: import builtins
  import contextlib
  import errno
  import functools
  from importlib import machinery, util, invalidate_caches
  import marshal
  import os
  import os.path
  from test.support import import_helper
  from test.support import os_helper
  import unittest
  import sys
  import tempfile
  import types
label_desc: Use image node_id 3 for calling a global function with example usage: specialize_class(cls, kind, base) and returns: specialized