'This gets called when a class that subclasses VersionedBase is defined.'

def __new__(mcs, metaname, bases, dict_):

    new_bases = []
    for base in bases:
        if (base.__name__ == u'VersionedBase'):
            register_plugin_table(dict_[u'__tablename__'], base.plugin, base.version)
            if (not any((isinstance(base, type(Base)) for base in bases))):
                new_bases.append(Base)
                class mcs(type(Base), mcs, ):
                    pass
        else:
            new_bases.append(base)
    return type.__new__(mcs, native_str(metaname), tuple(new_bases), dict_)
