Python Check If String Ends With Pattern