Generate Parentheses Leetcode Solution Python