[python] Python: How to use RegEx in an if statement?