def _generate_init_method(func):
    """
    Generate an __init__ method for a class based on the function's signature.
    """
    parameters = list(inspect.signature(func).parameters.values())
    param_names = [param.name for param in parameters]

    def init_method(self, *args, **kwargs):
        for name, value in zip(param_names, args):
            setattr(self, name, value)
        for name, value in kwargs.items():
            setattr(self, name, value)
        self.kwargs = kwargs

    init_method.__signature__ = inspect.signature(func)
    return init_method

    Generate an __init__ method for a class based on the function's signature.
    
braindecode/preprocessing/mne_preprocess.py