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__)

def auto_update_attrs_from_kwargs(method):
    """ 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__)
    """

    def wrapped(self, **kwargs):
        # method signature introspection
        argspec = inspect.getargspec(method)
        defaults = argspec.defaults or ()
        nb_args, nb_defaults = len(argspec.args), len(defaults)
        # construct a dict of method's keyword arguments
        options = dict(zip(argspec.args[nb_args - nb_defaults:], defaults))
        # update it with actual keyword arguments
        options.update(kwargs)
        # update attributes of instance
        self.__dict__.update(options)
        method(self, **kwargs)

    return wrapped