def __new__(cls, name, bases, attrs):
        # Create the class, e.g. the Synchro MongoClient or Database class.
        new_class = type.__new__(cls, name, bases, attrs)

        # delegate_class is a Motor class like MotorClient.
        delegate_class = new_class.__delegate_class__

        if delegate_class:
            delegated_attrs = {}

            for klass in reversed(inspect.getmro(delegate_class)):
                delegated_attrs.update(klass.__dict__)

            for attrname, delegate_attr in delegated_attrs.items():
                # If attrname is in attrs, it means Synchro has overridden
                # this attribute, e.g. Database.add_son_manipulator which is
                # special-cased. Ignore such attrs.
                if attrname not in attrs:
                    if getattr(
                            delegate_attr, 'is_async_method', False):
                        # Re-synchronize the method.
                        sync_method = Sync(
                            attrname, delegate_attr.has_write_concern)
                        setattr(new_class, attrname, sync_method)
                    elif isinstance(
                            delegate_attr, Unwrap):
                        # Re-synchronize the method.
                        sync_method = Sync(
                            attrname, delegate_attr.prop.has_write_concern)
                        setattr(new_class, attrname, sync_method)
                    elif getattr(
                            delegate_attr,
                            'is_motorcursor_chaining_method',
                            False):
                        # Wrap MotorCursors in Synchro Cursors.
                        wrapper = WrapOutgoing()
                        wrapper.name = attrname
                        setattr(new_class, attrname, wrapper)
                    elif isinstance(
                            delegate_attr,
                            ReadOnlyPropertyDescriptor):
                        # Delegate the property from Synchro to Motor.
                        setattr(new_class, attrname, delegate_attr)

        # Set DelegateProperties' and SynchroProperties' names.
        for name, attr in attrs.items():
            if isinstance(
                    attr,
                    (MotorAttributeFactory, SynchroProperty, WrapOutgoing)
            ):
                attr.name = name

        return new_class
dataset/ETHPy150Open mongodb/motor/synchro/__init__.py/SynchroMeta.__new__/original