Fix python3 iteration over dictionary.
Fix python3 iteration over dictionary.

In python3 python prevents modifying the dictionary that is iterated over.

Instead of modifying the dictionary a new one is constructed instead.

Fixes bsc#1123497

kubic-project/salt,kubic-project/salt,kubic-project/salt