nest function

Nest and un-nest an ir object