Given a list of upperbounds: B1, B2, .. BN;  

Dependency Functions: f1, ..., fN-1, 

I'm wondering if there's a recipe using itertools or other classes in python for:

```
for i1 in range(0, B1):  
    for i2 in range(f1(i1), B2): ...
         for iN in range(fN-1(iN-1), BN)
             dostuff(i1, i2, ... iN)

```

Where there are N levels of nesting?  

I want to use this helper function like this:  

**dependentProducts(Bs, fs, dostuff)**,  

which returns a list or iterable 

Ideally, the implementation would be iterative instead of recursive.