Python code to rotate messages cod 1