Python Preprocess Function Does Not Take Exception Meaning