<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stop(cls):
 """Stop the thread animation gracefully and reset_message"""

        if AnimatedDecorator._enabled:
            if cls.spinner.running:
                cls.spinner.running = False
                cls.animation.thread.join()

            if any(cls.animation.messages):
                cls.pop_message()

            sys.stdout = sys.__stdout__