Rather than saving the intended lock state and calling a method
depending on the lock state, just call the method directly. By the time
you need to the padlock state, you already know which method to use; no
need to first change the lock state than call the method.
Also, refactored print/error messages that are conditional.