Add utilities to deal with nesting / flattening

I think ultimately this should go to spaces/
Merge pull request #2 from lamblin/interface_change

Add utilities to deal with nesting / flattening