Hi @pwnsaur,
Starting from what you already have, you can probably do this:
from itertools import combinations_with_replacement
from ghpythonlib import treehelpers
combinations = combinations_with_replacement(xrange(x+1), y)
nested_combinations = []
for comb in combinations:
if sum(comb) == x and comb[0] > 0:
ncomb = []
for num in comb:
ncomb.append([num])
nested_combinations.append(ncomb)
a = treehelpers.list_to_tree(nested_combinations)
Also you should check this out!