def with_metaclass(meta, *bases):
class metaclass(meta):<EOL><INDENT>__call__ = type.__call__<EOL>__init__ = type.__init__<EOL>def __new__(cls, name, this_bases, d):<EOL><INDENT>if this_bases is None:<EOL><INDENT>return type.__new__(cls, name, (), d)<EOL><DEDENT>return meta(name, bases, d)<EOL><DEDENT><DEDENT>return metaclass("<STR_LIT>", None, {})<EOL>
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'>