The only way I found this is to do a deep clone of the object dumped in YAML. This is because YAML identifies the bindings and aliases based on their identity, and if you cloneor dup, the new object will be equal, but will have a different identification.
There are many ways to do a deep clone, including library support, or write your own helper function - I will leave this as an exercise for the reader.
source
share