Python Check If String Contains Any Substring From End Javascript