Detect Reset Reason in Python?