Solved subsets_with_sum problem in Python