Python Check If Variable Exists In Latex