Code Wars Python Challenge: Valid Parentheses