Fix printing of keys with non-string values

When trying to print a key which has a non-string value
(e.g. bool or int), TypeError exception is raised. This
is caused by the fact, that ensure_type() function accepts
string values, but parsed values are passed (i.e. False
instead of 'False' or 12 instead of '12' and so on).

Change-Id: I10f5e60994bc34288f15af07d2d255ace3755b57
Closes-Bug: #1243263