micro library that converts hierarchical structures to a flat ones (and back) preserving circular references