Decorator factory to delegate methods to an attribute.

    Decorate a class to map every method in `method_names` to the attribute `attribute_name`.

def delegate(attribute_name, method_names):
    """
    Decorator factory to delegate methods to an attribute.

    Decorate a class to map every method in `method_names` to the attribute `attribute_name`.

    """
    call_attribute_method = partial(_call_delegated_method, attribute_name)

    def decorate(class_):
        for method in method_names:
            setattr(class_, method, partialmethod(call_attribute_method, method))

        return class_
    return decorate