def attribute(method):
    """Decorator for parsing element attributes.

    Methods with this decorator must return a dictionary with interested
    attributes. The dictionary will then be passed to corresponded generator
    method as parameters.
    """
    def inner(*args, **kwargs):
        self = args[0]
        result = method(*args, **kwargs)
        if result:
            func = getattr(self.generator, method.__name__.rsplit('_')[-1])
            func(**result)
        return result
    return inner