import functools


def dec_check_lines(func):
    """
    Decorator to check the currently displayed lines on the LCD to prevent rewriting on the screen.
    """

    @functools.wraps(func)
    def wrapper(self, *args, **kwargs):
        str_args = str(args) + str(kwargs)
        if self.lines != str_args:
            self.lines = str_args
            func(self, *args, **kwargs)

    return wrapper