def auto_update_attrs_from_kwargs(method):
def wrapped(self, **kwargs):<EOL><INDENT>argspec = inspect.getargspec(method)<EOL>defaults = argspec.defaults or ()<EOL>nb_args, nb_defaults = len(argspec.args), len(defaults)<EOL>options = dict(zip(argspec.args[nb_args - nb_defaults:], defaults))<EOL>options.update(kwargs)<EOL>self.__dict__.update(options)<EOL>method(self, **kwargs)<EOL><DEDENT>return wrapped<EOL>
this decorator will update the attributes of an
     instance object with all the kwargs of the decorated
     method, updated with the kwargs of the actual call.
     This saves you from boring typing:
     self.xxxx = xxxx
     self.yyyy = yyyy
     ...
     in the decorated method (typically __init__)