import functools


def dec_busy(func):
    """
    Decorator to set the amp/lcd controller state to busy while executing function.
    """

    @functools.wraps(func)
    def wrapper(self, *args, **kwargs):
        self.busy = True
        output = func(self, *args, **kwargs)
        self.busy = False

        return output

    return wrapper