code: def add_metaclass(metaclass):
      """Class decorator for creating a class with a metaclass."""
  
      def wrapper(cls):
          orig_vars = cls.__dict__.copy()
          orig_vars.pop("__dict__", None)
          orig_vars.pop("__weakref__", None)
          for slots_var in orig_vars.get("__slots__", ()):
              orig_vars.pop(slots_var)
          return metaclass(cls.__name__, cls.__bases__, orig_vars)
  
      return wrapper
  
imports: import re
  import sys
label_desc: Use image node_id 18 for calling a global function with example usage: add_metaclass(metaclass) and returns: wrapper, metaclass