add generate parentheses python version