code: def with_metaclass(meta, *bases):
      
      class metaclass(meta):
          __call__ = type.__call__
          __init__ = type.__init__
          def __new__(cls, name, this_bases, d):
              if this_bases is None:
                  return type.__new__(cls, name, (), d)
              return meta(name, bases, d)
      return metaclass("NewBase", None, {})
docs: Create a base class with a metaclass.
  
      For example, if you have the metaclass
  
      >>> class Meta(type):
      ...     pass
  
      Use this as the metaclass by doing
  
      >>> from symengine.compatibility import with_metaclass
      >>> class MyClass(with_metaclass(Meta, object)):
      ...     pass
  
      This is equivalent to the Python 2::
  
          class MyClass(object):
              __metaclass__ = Meta
  
      or Python 3::
  
          class MyClass(object, metaclass=Meta):
              pass
  
      That is, the first argument is the metaclass, and the remaining arguments
      are the base classes. Note that if the base class is just ``object``, you
      may omit it.
  
      >>> MyClass.__mro__
      (<class 'MyClass'>, <... 'object'>)
      >>> type(MyClass)
      <class 'Meta'>