def create_lazy(attribute, factory):
    """Create attributes right before they are needed.

    Args:
        attribute (str): Attribute name to check/create
        factory (function): Factory to create object

    Returns:
        function: Decorator
    """
    def f_wrapper(func):
        """Create decorator

        Args:
            func (function): Function to wrap.

        Returns:
            function: Decorator
        """

        def wrapper(*args, **kwargs):
            """Decorator implementation

            Args:
                *args (list): Original func arguments
                **kwargs (dict): Original func arguments

            Returns:
                object: Result produced by the wrapped func
            """
            this = args[0]
            if not hasattr(this, attribute) or not getattr(this, attribute):
                setattr(this, attribute, factory(this))
            return func(*args, **kwargs)
        return wrapper
    return f_wrapper