def METHOD_NAME():  # sourcery no-metrics
    """Wraps the `__init__` method of a class to automatically set the common
    attributes.
    Args:
        exclude (Union[set, list], optional): [description]. Defaults to None.
    """
    def decorator(init):
        @wraps(init)
        def wrapper(self: SqlAlchemyBase, *args, **kwargs):  # sourcery no-metrics
            """
            Custom initializer that allows nested children initialization.
            Only keys that are present as instance's class attributes are allowed.
            These could be, for example, any mapped columns or relationships.
            Code inspired from GitHub.
            Ref: https://github.com/tiangolo/fastapi/issues/2194
            """
            cls = self.__class__
            config = _get_config(cls)
            exclude = config.exclude
            alchemy_mapper: Mapper = self.__mapper__
            model_columns: ColumnCollection = alchemy_mapper.columns
            relationships = alchemy_mapper.relationships
            session: Session = kwargs.get("session", None)
            if session is None:
                raise ValueError("Session is required to initialize the model with `auto_init`")
            for key, val in kwargs.items():
                if key in exclude:
                    continue
                if not hasattr(cls, key):
                    continue
                    # raise TypeError(f"Invalid keyword argument: {key}")
                if key in model_columns:
                    setattr(self, key, val)
                    continue
                if key in relationships:
                    prop: RelationshipProperty = relationships[key]
                    # Identifies the type of relationship (ONETOMANY, MANYTOONE, many-to-one, many-to-many)
                    relation_dir = prop.direction
                    # Identifies the parent class of the related object.
                    relation_cls: type[SqlAlchemyBase] = prop.mapper.entity
                    # Identifies if the relationship was declared with use_list=True
                    use_list: bool = prop.uselist
                    get_attr = get_lookup_attr(relation_cls)
                    if relation_dir == ONETOMANY and use_list:
                        instances = handle_one_to_many_list(session, get_attr, relation_cls, val)
                        setattr(self, key, instances)
                    elif relation_dir == ONETOMANY:
                        instance = safe_call(relation_cls, val, session=session)
                        setattr(self, key, instance)
                    elif relation_dir == MANYTOONE and not use_list:
                        if isinstance(val, dict):
                            val = val.get(get_attr)
                            if val is None:
                                raise ValueError(f"Expected 'id' to be provided for {key}")
                        if isinstance(val, str | int | UUID):
                            stmt = select(relation_cls).filter_by(**{get_attr: val})
                            instance = session.execute(stmt).scalars().one_or_none()
                            setattr(self, key, instance)
                        else:
                            # If the value is not of the type defined above we assume that it isn't a valid id
                            # and try a different approach.
                            pass
                    elif relation_dir == MANYTOMANY:
                        instances = handle_many_to_many(session, get_attr, relation_cls, val)
                        setattr(self, key, instances)
            return init(self, *args, **kwargs)
        return wrapper
    return decorator